diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-04-05 11:26:56 +0200 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-04-05 11:26:56 +0200 |
| commit | ff184361a9af7b8fa525c765f241830004e29347 (patch) | |
| tree | 5f0aba219079e96874e4a2bcbce339d14ed0a175 /src/http.go | |
| parent | f826441dc4a72c7797fec36de5214d6524b9d6c5 (diff) | |
Return http code error if status code is not 2xx
Diffstat (limited to 'src/http.go')
| -rw-r--r-- | src/http.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/http.go b/src/http.go index bd06342..8243500 100644 --- a/src/http.go +++ b/src/http.go @@ -160,7 +160,7 @@ func HTTPMethodWithOpts(method string, url string, opts *HTTPOptionalParams) (ht return resp.Header, nil, &HTTPReadError{URL: url, Err: readErr} } - if resp.StatusCode != 200 { + if resp.StatusCode < 200 || resp.StatusCode > 299 { return resp.Header, body, &HTTPStatusError{URL: url, Status: resp.StatusCode} } |
