Http: mark non-success status errors as permanent

This commit is contained in:
andig 2025-05-04 12:39:21 +02:00
parent 523e3eeffb
commit 473747d8ef

View file

@ -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