Do not parse json on 204 responses (#476)
* Do not return BadResponse for no content Signed-off-by: Adam Jaso <2285656+adamjaso@users.noreply.github.com>
This commit is contained in:
parent
0a8115f42e
commit
93edea3720
|
@ -477,10 +477,12 @@ func (c apiClient) Do(ctx context.Context, req *http.Request) (*http.Response, [
|
||||||
|
|
||||||
var result apiResponse
|
var result apiResponse
|
||||||
|
|
||||||
if err = json.Unmarshal(body, &result); err != nil {
|
if http.StatusNoContent != code {
|
||||||
return resp, body, &Error{
|
if err = json.Unmarshal(body, &result); err != nil {
|
||||||
Type: ErrBadResponse,
|
return resp, body, &Error{
|
||||||
Msg: err.Error(),
|
Type: ErrBadResponse,
|
||||||
|
Msg: err.Error(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue