Skip to content

Commit

Permalink
fix #362 : SendRequest always return 0 when the expected status code …
Browse files Browse the repository at this point in the history
…is different of the status code
  • Loading branch information
flbla committed Aug 21, 2023
1 parent 7453ba3 commit 871601e
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,8 @@ func (c *Client) SendRequest(method string, path string, payload interface{}, st
return "", "", resp.StatusCode, err
}

if statusCode != 0 {
if resp.StatusCode != statusCode {

return "", "", 0, fmt.Errorf("[ERROR] unexpected status code got: %v expected: %v \n %v", resp.StatusCode, statusCode, strbody)
}
if statusCode != 0 && resp.StatusCode != statusCode {
return "", "", resp.StatusCode, fmt.Errorf("[ERROR] unexpected status code got: %v expected: %v \n %v", resp.StatusCode, statusCode, strbody)
}

return strbody, string(headers), resp.StatusCode, nil
Expand Down

0 comments on commit 871601e

Please sign in to comment.