Skip to content

Commit

Permalink
fix: test
Browse files Browse the repository at this point in the history
  • Loading branch information
fredmaggiowski committed Jun 30, 2023
1 parent e9504b6 commit 666fb65
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion core/opa_transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (t *OPATransport) RoundTrip(req *http.Request) (resp *http.Response, err er

if !utils.HasApplicationJSONContentType(resp.Header) {
t.logger.WithField("foundContentType", resp.Header.Get(utils.ContentTypeHeaderKey)).Debug("found content type")
t.responseWithError(resp, fmt.Errorf("%w: response content-type should be application/json", ErrUnexepectedContentType), http.StatusInternalServerError)
t.responseWithError(resp, fmt.Errorf("%w: response content-type is not application/json", ErrUnexepectedContentType), http.StatusInternalServerError)
return resp, nil
}

Expand Down
2 changes: 1 addition & 1 deletion core/opa_transport_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ func TestOPATransportRoundTrip(t *testing.T) {
require.Equal(t, http.StatusInternalServerError, resp.StatusCode)
bodyBytes, err := io.ReadAll(resp.Body)
require.Nil(t, err)
require.Contains(t, string(bodyBytes), "content-type is not application/json")
require.Contains(t, string(bodyBytes), "content-type should be application/json")
})

t.Run("failure on non-json response even with json content-type", func(t *testing.T) {
Expand Down

0 comments on commit 666fb65

Please sign in to comment.