fixed status check
This commit is contained in:
parent
f5ff99a2a8
commit
1c3a45729b
2
do.go
2
do.go
@ -12,7 +12,7 @@ func Do(req *http.Request) (*http.Response, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ParseJsonResponse[T any](resp *http.Response) (*T, error) {
|
func ParseJsonResponse[T any](resp *http.Response) (*T, error) {
|
||||||
if resp.StatusCode/100 == 2 {
|
if resp.StatusCode/100 != 2 {
|
||||||
return nil, fmt.Errorf(
|
return nil, fmt.Errorf(
|
||||||
"request '%s' returned status code %s\nOutput: %s",
|
"request '%s' returned status code %s\nOutput: %s",
|
||||||
resp.Request.URL.String(),
|
resp.Request.URL.String(),
|
||||||
|
Loading…
Reference in New Issue
Block a user