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

Fixed case sensitivity issue for the 'Content-Type' header when using AWS API Gateway and Lambda #245

Merged
merged 3 commits into from
Jan 26, 2023
Merged

Fixed case sensitivity issue for the 'Content-Type' header when using AWS API Gateway and Lambda #245

merged 3 commits into from
Jan 26, 2023

Conversation

timmattison
Copy link
Contributor

If you use tRPC OpenAPI with AWS API Gateway and Lambda I ran into an issue where my input payload does not come through (it is always empty) but the data is in the request.

It appears that the code looks for the content-type header with an exact string match and if it doesn't find it it skips past processing the body.

HTTP/1.1 headers are case-insensitive so the logic needs to be updated to take this into account.

This PR modifies an existing test to set the content type value to something that won't pass and then includes the code to fix it.

NOTE: If you make a request to API Gateway with HTTP/2 this issue does not occur. It only happens with HTTP/1.1. If you try to reproduce it and you cannot make sure you are sending HTTP/1.1 requests only.

Copy link
Owner

@jlalmes jlalmes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this @timmattison! 🚀

@jlalmes jlalmes merged commit 8c3145b into jlalmes:master Jan 26, 2023
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.

None yet

2 participants