Repository navigation
fix(parser): accept API Gateway console test events without headers - #8852
Open
Manishram-ai wants to merge 1 commit into
Open
Manishram-ai wants to merge 1 commit into
Manishram-ai wants to merge 1 commit into
Conversation
|
This branch has not been deployed
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.



Issue number:
closes #8849
Summary
Changes
APIGatewayProxyEventModelturns a nullheadersormultiValueHeadersinto an empty dict before validating. The Test tab in the API Gateway console sends null for both when the test has no headers.ApiGatewayAuthorizerRequestinherits the same validator.dict, so handlers don't need a None check.tests/events/apiGatewayProxyEventConsoleTest.json, the one captured from the Test tab in Feature Request: add APIGatewayRequestAuthorizerEventV2 schemas/envelopes powertools-lambda-typescript#2624 with the IAM user name replaced, and a test that parses it.User experience
Today a REST API handler using
APIGatewayProxyEventModelfails with aValidationErrorwhen you test it from the console without headers, even though the parser already accepts the console'stest-invoke-source-ip. With this change the event parses, andheadersandmultiValueHeadersare{}. Requests with headers parse the same as before.Verification
developwithInput should be a valid dictionaryforheadersandmultiValueHeaders, and passes with this change.tests/unit/parserandtests/functional/parser: 273 passed on Python 3.10, 3.12 and 3.14.ruff check,ruff format --checkandmypyare clean, andtests/performancepasses.APIGatewayRestResolveralready returns 200 for it ondevelop.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.