-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
feat(apigateway): mutate methodresponses added by integrations #26718
Conversation
The `StepFunctionsIntegration` adds methodResponses for status codes `200`, `400` and `500`. Because `addMethodResponse()` only ever adds to the method response array, this makes it impossible for a user to modify any of the responses added by the integration (for example, to add headers).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
A comment requesting an exemption should contain the text Exemption Request
. Additionally, if clarification is needed add Clarification Request
to a comment.
2ca7776
to
bf6dc66
Compare
The pull request linter fails with the following errors:
PRs must pass status checks before we can provide a meaningful review. If you would like to request an exemption from the status checks or clarification on feedback, please leave a comment on this PR containing |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
No one seems to need this change. Closing until we get interest on it. |
The
StepFunctionsIntegration
integration can produce200
,400
or500
status codes.To make its usage more convenient, it also adds default methodResponses for each of those statuses; if it didn't do this, the user would have to define the 3 method responses every time it uses the integration. However, the problem comes if the user wants to modify the default method responses. This is currently not possible, as
addMethodResponse
will just add to the array, adding multiple entries for the same statusCode, of which CloudFormation will deploy one nondeterministically and the rest is lost.This PR address this problem by extending the feature set of
addMethodResponse
. It shouldn't currently be called multiple times for the same status code. We add that feature, and define that it merges the new method response fields with any existing method responses that share the same status code.This makes it trivial to do things like add headers to existing responses.
Sister PR to #26720.
Relates to #26586 and #26636.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license