fix(parser): body/QS can be null or omitted in apigw v1/v2 #820
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 #, if available: #797
Description of changes:
Parser incorrectly expected
bodyto always be non-empty; this addresses it.Actual event tested to repro #797
{ "body": null, "resource": "/users", "path": "/users", "httpMethod": "GET", "headers": { "Accept": "*/*", "CloudFront-Forwarded-Proto": "https", "CloudFront-Is-Desktop-Viewer": "true", "CloudFront-Is-Mobile-Viewer": "false", "CloudFront-Is-SmartTV-Viewer": "false", "CloudFront-Is-Tablet-Viewer": "false", "CloudFront-Viewer-Country": "NL", "Host": "a1c2k0n4x4.execute-api.eu-west-1.amazonaws.com", "User-Agent": "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)", "Via": "2.0 b619a16f6f8fe9793bf642d2a8434284.cloudfront.net (CloudFront)", "X-Amz-Cf-Id": "sj5uo2ZyuF8WvtxH6IYxHMQFHCuMWaD-xE5T-7WFZR28Jz-Kp4Zvsw==", "X-Amzn-Trace-Id": "Root=1-618ff3e6-6e0fdf4f4197d0e7437264dd", "X-Forwarded-For": "83.41.50.10, 54.200.158.122", "X-Forwarded-Port": "443", "X-Forwarded-Proto": "https" }, "multiValueHeaders": { "Accept": [ "*/*" ], "CloudFront-Forwarded-Proto": [ "https" ], "CloudFront-Is-Desktop-Viewer": [ "true" ], "CloudFront-Is-Mobile-Viewer": [ "false" ], "CloudFront-Is-SmartTV-Viewer": [ "false" ], "CloudFront-Is-Tablet-Viewer": [ "false" ], "CloudFront-Viewer-Country": [ "NL" ], "Host": [ "a1c2k0n4x4.execute-api.eu-west-1.amazonaws.com" ], "User-Agent": [ "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)" ], "Via": [ "2.0 b619a16f6f8fe9793bf642d2a8434284.cloudfront.net (CloudFront)" ], "X-Amz-Cf-Id": [ "sj5uo2ZyuF8WvtxH6IYxHMQFHCuMWaD-xE5T-7WFZR28Jz-Kp4Zvsw==" ], "X-Amzn-Trace-Id": [ "Root=1-618ff3e6-6e0fdf4f4197d0e7437264dd" ], "X-Forwarded-For": [ "83.41.50.10, 54.200.158.122" ], "X-Forwarded-Port": [ "443" ], "X-Forwarded-Proto": [ "https" ] }, "queryStringParameters": null, "multiValueQueryStringParameters": null, "pathParameters": null, "stageVariables": null, "requestContext": { "resourceId": "sfqe1d", "resourcePath": "/users", "httpMethod": "GET", "extendedRequestId": "IwMMEGaOjoEF_zw=", "requestTime": "13/Nov/2021:17:20:38 +0000", "path": "/Prod/users", "accountId": "231436140809", "protocol": "HTTP/1.1", "stage": "Prod", "domainPrefix": "a1c2k0n4x4", "requestTimeEpoch": 1636824038666, "requestId": "4fdd98f4-0570-46cb-b683-b0d02afe9dca", "identity": { "cognitoIdentityPoolId": null, "accountId": null, "cognitoIdentityId": null, "caller": null, "sourceIp": "83.41.50.10", "principalOrgId": null, "accessKey": null, "cognitoAuthenticationType": null, "cognitoAuthenticationProvider": null, "userArn": null, "userAgent": "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)", "user": null }, "domainName": "a1c2k0n4x4.execute-api.eu-west-1.amazonaws.com", "apiId": "a1c2k0n4x4" }, "isBase64Encoded": false }Checklist
Breaking change checklist
RFC issue #:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.