summaryrefslogtreecommitdiff
path: root/src/http.go
diff options
context:
space:
mode:
authorJeroen Wijenbergh <jeroenwijenbergh@protonmail.com>2022-03-28 23:29:43 +0200
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2022-03-28 23:29:43 +0200
commit6192f9ab54a805c1fabe6a2c5b8eca622b565082 (patch)
treef889404ebca573c8ecc886ea1858dc6822158f6e /src/http.go
parent785e34a4ebacee7dea16af6d16725647b7f6fd7d (diff)
OAuth: Token refresh changes and tests
Diffstat (limited to 'src/http.go')
-rw-r--r--src/http.go6
1 files changed, 5 insertions, 1 deletions
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
}