Skip to content

Commit

Permalink
💄 adding check for -1 status code for the default impl (#4897)
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>
  • Loading branch information
matzew committed Feb 19, 2021
1 parent 403aefa commit 4e5bdf9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/kncloudevents/message_sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func RetryConfigFromDeliverySpec(spec duckv1.DeliverySpec) (RetryConfig, error)

// Simple default implementation
func RetryIfGreaterThan300(_ context.Context, response *nethttp.Response, err error) (bool, error) {
return !(response != nil && (response.StatusCode < 300)), err
return !(response != nil && (response.StatusCode < 300 && response.StatusCode != -1)), err
}

// Alternative function to determine whether to retry based on response
Expand Down
2 changes: 1 addition & 1 deletion pkg/kncloudevents/message_sender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ func TestRetryIfGreaterThan300(t *testing.T) {
{
name: "Http StatusCode -1",
response: &http.Response{StatusCode: -1},
result: false,
result: true,
},
{
name: "Http StatusCode 100",
Expand Down

0 comments on commit 4e5bdf9

Please sign in to comment.