Skip to content

Commit

Permalink
bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
averche committed Dec 11, 2023
1 parent 9228eb2 commit aabd46e
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ import (

func Test_isResponseError(t *testing.T) {
cases := map[string]struct {
statusCode int
body string
expectedError bool
expectedErrors []string
expectedRawResponseBody []byte
statusCode int
body string
expectedError bool
expectedErrors []string
expectedRawResponseBytes []byte
}{
"non-error": {
statusCode: http.StatusOK,
Expand All @@ -40,18 +40,18 @@ func Test_isResponseError(t *testing.T) {
expectedErrors: []string{"single error"},
},
"json-response-without-errors": {
statusCode: http.StatusNotFound,
body: `{"data":{"key1":"value1","key2":"value2"}}`,
expectedError: true,
expectedErrors: nil,
expectedRawResponseBody: []byte(`{"data":{"key1":"value1","key2":"value2"}}`),
statusCode: http.StatusNotFound,
body: `{"data":{"key1":"value1","key2":"value2"}}`,
expectedError: true,
expectedErrors: nil,
expectedRawResponseBytes: []byte(`{"data":{"key1":"value1","key2":"value2"}}`),
},
"non-json-response": {
statusCode: http.StatusTeapot,
body: `this is just a string`,
expectedError: true,
expectedErrors: nil,
expectedRawResponseBody: []byte(`this is just a string`),
statusCode: http.StatusTeapot,
body: `this is just a string`,
expectedError: true,
expectedErrors: nil,
expectedRawResponseBytes: []byte(`this is just a string`),
},
}

Expand All @@ -75,7 +75,7 @@ func Test_isResponseError(t *testing.T) {

assert.Equal(t, tc.statusCode, responseError.StatusCode)
assert.Equal(t, tc.expectedErrors, responseError.Errors)
assert.Equal(t, tc.expectedRawResponseBody, responseError.RawResponseBytes)
assert.Equal(t, tc.expectedRawResponseBytes, responseError.RawResponseBytes)
})
}
}

0 comments on commit aabd46e

Please sign in to comment.