Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add protocol test for client handling two X-Amzn-Errortype header values #1934

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion smithy-aws-protocol-tests/model/awsJson1_0/errors.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -261,5 +261,22 @@ apply FooError @httpResponseTests([
}""",
bodyMediaType: "application/json",
appliesTo: "client",
}
},
{
id: "AwsJson10FooErrorWithMultipleAmznErrorTypes",
documentation: """
API Gateway always adds its own x-amzn-errortype header on gateway responses.
However, this header does not match the error configured in customers model and \
results in two X-Amzn-Errortype header values. \
The first value is provided by the customer and the second value is from API Gateway \

Clients need to split the header value on ',' and take only the first element. \
For example, 'FooError,InvalidParameterException' is to be interpreted as 'FooError'.""",
protocol: awsJson1_0,
code: 500,
headers: {
"X-Amzn-Errortype": "FooError,InvalidParameterException",
},
appliesTo: "client",
},
])
19 changes: 18 additions & 1 deletion smithy-aws-protocol-tests/model/awsJson1_1/errors.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -253,5 +253,22 @@ apply FooError @httpResponseTests([
}""",
bodyMediaType: "application/json",
appliesTo: "client",
}
},
{
id: "AwsJson11FooErrorWithMultipleAmznErrorTypes",
documentation: """
API-Gateway always adds its own x-amzn-errortype header on gateway responses.
However, this header does not match the error configured in customers model and \
results in two X-Amzn-Errortype header values. \
The first value is provided by the customer and the second value is from API Gateway \

Clients need to split the header value on ',' and take only the first element. \
For example, 'FooError,InvalidParameterException' is to be interpreted as 'FooError'.""",
protocol: awsJson1_1,
code: 500,
headers: {
"X-Amzn-Errortype": "FooError,InvalidParameterException",
},
appliesTo: "client",
},
])
18 changes: 17 additions & 1 deletion smithy-aws-protocol-tests/model/restJson1/errors.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ apply InvalidGreeting @httpResponseTests([
}""",
bodyMediaType: "application/json",
},

])

/// This error is thrown when a request is invalid.
Expand Down Expand Up @@ -306,5 +305,22 @@ apply FooError @httpResponseTests([
}""",
bodyMediaType: "application/json",
appliesTo: "client",
},
{
id: "RestJsonWithMultipleAmznErrorTypes",
documentation: """
API-Gateway always adds its own x-amzn-errortype header on gateway responses.
However, this header does not match the error configured in customers model and \
results in two X-Amzn-Errortype header values. \
The first value is provided by the customer and the second value is from API Gateway \

Clients need to split the header value on ',' and take only the first element. \
For example, 'FooError,InvalidParameterException' is to be interpreted as 'FooError'.""",
protocol: restJson1,
code: 500,
headers: {
"X-Amzn-Errortype": "FooError,InvalidParameterException",
},
appliesTo: "client",
}
])