Skip to content

Commit

Permalink
Remove returning the response body: (#350)
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Sep 20, 2023
2 parents b9b7ef8 + 730ce0d commit 44c2961
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions providers/rpc/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ func (p *Provider) handleResponse(statusCode int, headers http.Header, body *byt
if statusCode != http.StatusOK {
return ResponsePayload{}, fmt.Errorf("unexpected status code: %d, response error(optional): %v", statusCode, res.Error)
}
example, _ := json.Marshal(ResponsePayload{ID: 123, Host: p.Host, Error: &ResponseError{Code: 1, Message: "error message"}})
return ResponsePayload{}, fmt.Errorf("failed to parse response: got: %q, error: %w, expected response json spec: %v", body.String(), err, string(example))
return ResponsePayload{}, fmt.Errorf("failed to parse response: %w", err)
}
if statusCode != http.StatusOK {
return ResponsePayload{}, fmt.Errorf("unexpected status code: %d, response error(optional): %v", statusCode, res.Error)
Expand Down
2 changes: 1 addition & 1 deletion providers/rpc/rpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func TestPowerStateGet(t *testing.T) {
shouldErr bool
url string
}{
"success": {},
"success": {powerState: "on"},
"unknown state": {shouldErr: true},
}

Expand Down

0 comments on commit 44c2961

Please sign in to comment.