Skip to content

Commit

Permalink
Handle 204 no content responses (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
danafallon authored Jan 3, 2025
1 parent 0bd014f commit b0a92bb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/artieclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ func (c Client) makeRequest(ctx context.Context, method string, path string, bod
}
defer resp.Body.Close()

if resp.StatusCode != http.StatusOK {
if resp.StatusCode >= 300 {
return buildError(resp)
}

if out != nil {
if out != nil && resp.StatusCode != http.StatusNoContent {
if err := json.NewDecoder(resp.Body).Decode(&out); err != nil {
return fmt.Errorf("artie-client: failed to decode response body: %w", err)
}
Expand Down

0 comments on commit b0a92bb

Please sign in to comment.