Description
If I send event with HTTP protocol (without retrying), in the Result I can see also body response. This is useful to understand what went wrong.
However, if I send event with HTTP Protocol and passing retry options via context like
Send(cloudevents.ContextWithRetriesExponentialBackoff(ctx, time.Second, 3), evt)
I'm getting back only status code. Not the body itself.
Source of bug
I believe the issue is on line 181 in ⬇️ because you are expecting err is type of http.Result. But after retrying, it is protocol.Result.
|
if err != nil && !protocol.IsACK(err) { |
|
var res *Result |
|
if protocol.ResultAs(err, &res) { |
|
if message, ok := msg.(*Message); ok { |
|
buf := new(bytes.Buffer) |
|
buf.ReadFrom(message.BodyReader) |
|
errorStr := buf.String() |
|
// If the error is not wrapped, then append the original error string. |
|
if og, ok := err.(*Result); ok { |
|
og.Format = og.Format + "%s" |
|
og.Args = append(og.Args, errorStr) |
|
err = og |
|
} else { |
|
err = NewResult(res.StatusCode, "%w: %s", err, errorStr) |
|
} |
|
} |
|
} |
|
} |
|
return err |
Description
If I send event with HTTP protocol (without retrying), in the Result I can see also body response. This is useful to understand what went wrong.
However, if I send event with HTTP Protocol and passing retry options via context like
I'm getting back only status code. Not the body itself.
Source of bug
I believe the issue is on line 181 in ⬇️ because you are expecting
erris type ofhttp.Result. But after retrying, it isprotocol.Result.sdk-go/v2/protocol/http/protocol.go
Lines 179 to 197 in 44dff96