Skip to content

Commit

Permalink
Remove status code from error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
royroyee committed Mar 31, 2024
1 parent 6b1da42 commit 5e32807
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@ func (ac *AlpaconClient) sendRequest(req *http.Request) ([]byte, error) {
}

if req.Method == "POST" && (resp.StatusCode != http.StatusCreated && resp.StatusCode != http.StatusOK) {
return nil, errors.New(resp.Status + string(respBody))
return nil, errors.New(string(respBody))
} else if req.Method == "DELETE" && resp.StatusCode != http.StatusNoContent {
return nil, errors.New(resp.Status + string(respBody))
return nil, errors.New(string(respBody))
} else if resp.StatusCode < http.StatusOK || resp.StatusCode >= http.StatusMultipleChoices {
return nil, errors.New(resp.Status + string(respBody))
return nil, errors.New(string(respBody))
}

return respBody, nil
Expand Down Expand Up @@ -209,7 +209,7 @@ func (ac *AlpaconClient) SendMultipartRequest(url string, multiPartWriter *multi
}

if resp.StatusCode != http.StatusCreated {
return nil, errors.New(resp.Status + string(respBody))
return nil, errors.New(string(respBody))
}

return respBody, nil
Expand Down

0 comments on commit 5e32807

Please sign in to comment.