diff --git a/v2/protocol/http/protocol.go b/v2/protocol/http/protocol.go index b3566e6c8..bf0d8d37b 100644 --- a/v2/protocol/http/protocol.go +++ b/v2/protocol/http/protocol.go @@ -157,7 +157,17 @@ func (p *Protocol) Send(ctx context.Context, m binding.Message, transformers ... buf := new(bytes.Buffer) buf.ReadFrom(message.BodyReader) errorStr := buf.String() - err = NewResult(res.StatusCode, "%w: %s", err, errorStr) + // If the error is not wrapped, then append the original error string. + if og, ok := err.(*Result); ok { + if len(og.Format) == 0 { + og.Format = "%s" + } else { + og.Format = og.Format + ": %s" + } + og.Args = append(og.Args, errorStr) + } else { + err = NewResult(res.StatusCode, "%w: %s", err, errorStr) + } } } }