Skip to content
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

fix: lowercase API gateway V2 event headers #1288

Conversation

domdomegg
Copy link
Contributor

Description

As per the AWS documentation, header names are lowercased before being passed to the function for API Gateway HTTP API events (known in serverless as httpApi). This change ensures serverless-offline accurately reflects the header handling done by AWS Lambda.

image

NB: this does not update the behaviour of API Gateway REST API events, where serverless-offline does not change the header capitalization to match Amazon.

Motivation and Context

Fixes #1207

How Has This Been Tested?

Tested it on my own service, and appears to work well.

Added unit tests for lowerCaseKeys helper function.

Added integration test for header lowercasing.

As per the [AWS documentation](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html), header names are lowercased before being passed to the function. This change ensures serverless-offline accurately reflects the header handling done by AWS Lambda.
@domdomegg
Copy link
Contributor Author

Hi @pgrzesik, are you able to review this please?

@dnalborczyk
Copy link
Collaborator

thank you @domdomegg !

@dnalborczyk dnalborczyk merged commit 9ff4cf3 into dherault:master May 16, 2022
@domdomegg domdomegg deleted the domdomegg/lowercase-api-gateway-event-headers branch May 17, 2022 22:28
@domdomegg
Copy link
Contributor Author

Thanks for merging this @dnalborczyk :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Content-type header is not lowercased
2 participants