fix APIGW request validation with empty request body#7916
Merged
Conversation
1 task
whummer
approved these changes
Mar 20, 2023
Member
whummer
left a comment
There was a problem hiding this comment.
Great extension for the previous fix, kudos for jumping on this one so quickly! 🚀
| "httpMethod": "POST", | ||
| "methodIntegration": { | ||
| "cacheKeyParameters": [], | ||
| "cacheNamespace": "5l4d79", |
Member
There was a problem hiding this comment.
nit: we could add a transformer (e.g., key_value(..)) to store a placeholder for this value - to make the test repeatable against AWS (without updating the snapshot) as well. 👍
Contributor
Author
There was a problem hiding this comment.
Right, yes! Good catch. It is repeatable at the moment because we're skipping the verification of the snapshot because methodIntegration format is very not in parity, but I'll add the transformer right now, because the git diff is ugly. Thanks for pointing this out!
edit: I actually missed that one and it was correct, we were returning the field, so thanks again.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Following #7842, we were missing a step in the validation: if the request body was empty, we should consider the request body as an empty JSON object to allow the validation to take effect, and not throw an error for invalid JSON.
I've extended the existing test for the request validator integration to add the
GETmethod, and test with a request with no request body.