From ff184361a9af7b8fa525c765f241830004e29347 Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Tue, 5 Apr 2022 11:26:56 +0200 Subject: Return http code error if status code is not 2xx --- src/http.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') 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} } -- cgit v1.2.3