Fixed case sensitivity issue for the 'Content-Type' header when using AWS API Gateway and Lambda #245
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.
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.