Skip to content

Commit

Permalink
test: add unknown error mixed header cases
Browse files Browse the repository at this point in the history
  • Loading branch information
jar-b committed Feb 27, 2023
1 parent d087d7c commit 6697bc6
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions private/protocol/restjson/unmarshal_error_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,32 @@ func TestUnmarshalTypedError(t *testing.T) {
respMeta.RequestID,
),
},
"unknown code header only": {
Response: &http.Response{
Header: http.Header{
errorTypeHeader: []string{"UnknownError"},
},
Body: ioutil.NopCloser(strings.NewReader(unknownErrJSON)),
},
Expect: awserr.NewRequestFailure(
awserr.New("UnknownError", "error message", nil),
respMeta.StatusCode,
respMeta.RequestID,
),
},
"unknown message header only": {
Response: &http.Response{
Header: http.Header{
errorMessageHeader: []string{"overwritten error message"},
},
Body: ioutil.NopCloser(strings.NewReader(unknownErrJSON)),
},
Expect: awserr.NewRequestFailure(
awserr.New("UnknownError", "error message", nil),
respMeta.StatusCode,
respMeta.RequestID,
),
},
"code from header": {
Response: &http.Response{
Header: http.Header{
Expand Down

0 comments on commit 6697bc6

Please sign in to comment.