Smithy is a protocol-agnostic interface definition language and set of tools for generating clients, servers, and documentation for any programming language.
Maps all unique content-types for operations in CORS preflight integration template, in addition to the application/json template that is currently added.
Sets the passthroughBehavior for the mock integration to "never" to fail-fast with 415 Unsupported in case a request is made with unsupported Content-Type.
Both these features are behind a new OpenAPI configuration syncCorsPreflightIntegration (not sure about the name), which the service teams can turn on.
Why are they important?
So that API Gateway does not error out when OPTIONS request is made with a custom payload and a Content-Type other than application/json. This will pass the request to the actual GET/PUT/... method.
Requests made with unsupported Content-Type fail fast with 415 Unsupported instead of receiving 500 InternalServerError from API Gateway.
Testing
How did you test these changes?
[x] Added test cases for the new changes.
[x] Checked backwards compatibility by running ./gradlew clean build.
Background
application/json
template that is currently added.passthroughBehavior
for the mock integration to "never" to fail-fast with 415 Unsupported in case a request is made with unsupported Content-Type.syncCorsPreflightIntegration
(not sure about the name), which the service teams can turn on.application/json
. This will pass the request to the actual GET/PUT/... method.Testing
./gradlew clean build
.Links
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.