Skip to content

Commit

Permalink
RHINENG-9505: parse response only if not empty
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelMraka committed Sep 9, 2024
1 parent 5548a65 commit 0acc23e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions base/api/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ func (o *Client) Request(ctx *context.Context, method, url string,
return httpResp, errors.Wrap(err, "Response body reading failed")
}

err = json.Unmarshal(bodyBytes, responseOutPtr)
if err != nil {
return httpResp, errors.Wrap(err, "Response json parsing failed")
if len(bodyBytes) > 0 {
err = json.Unmarshal(bodyBytes, responseOutPtr)
if err != nil {
return httpResp, errors.Wrap(err, "Response json parsing failed")
}
}
return httpResp, nil
}
Expand Down

0 comments on commit 0acc23e

Please sign in to comment.