From 6192f9ab54a805c1fabe6a2c5b8eca622b565082 Mon Sep 17 00:00:00 2001 From: Jeroen Wijenbergh Date: Mon, 28 Mar 2022 23:29:43 +0200 Subject: OAuth: Token refresh changes and tests --- src/http.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/http.go') diff --git a/src/http.go b/src/http.go index bc2cc20..bd06342 100644 --- a/src/http.go +++ b/src/http.go @@ -160,6 +160,10 @@ func HTTPMethodWithOpts(method string, url string, opts *HTTPOptionalParams) (ht return resp.Header, nil, &HTTPReadError{URL: url, Err: readErr} } - // Return the body in bytes and signal that there was no error + if resp.StatusCode != 200 { + return resp.Header, body, &HTTPStatusError{URL: url, Status: resp.StatusCode} + } + + // Return the body in bytes and signal the status error if there was one return resp.Header, body, nil } -- cgit v1.2.3