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 (#363)

Signed-off-by: flbla <flbla@users.noreply.github.com>
  • Loading branch information
flbla authored Aug 21, 2023
1 parent 14f33d1 commit d4a4dfb
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 d4a4dfb

Please sign in to comment.