return error when not 200 for GET method
parent
d1e98eb548
commit
dd7163e01e
|
@ -47,6 +47,11 @@ func (c *Client) doAPI(method string, uri string, params url.Values, res interfa
|
|||
if res == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
if method == "GET" && resp.StatusCode != 200 {
|
||||
return fmt.Errorf("bad request: %v", resp.Status)
|
||||
}
|
||||
|
||||
return json.NewDecoder(resp.Body).Decode(&res)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue