Http: mark non-success status errors as permanent
This commit is contained in:
parent
523e3eeffb
commit
473747d8ef
1 changed files with 3 additions and 1 deletions
|
|
@ -4,6 +4,8 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/cenkalti/backoff/v4"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
@ -89,7 +91,7 @@ func ReadBody(resp *http.Response) ([]byte, error) {
|
|||
}
|
||||
|
||||
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
|
||||
return b, &StatusError{resp: resp}
|
||||
return b, backoff.Permanent(&StatusError{resp: resp})
|
||||
}
|
||||
|
||||
return b, nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue