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

Content-type header is not lowercased #1207

Closed
nponeccop opened this issue Apr 6, 2021 · 0 comments · Fixed by #1288
Closed

Content-type header is not lowercased #1207

nponeccop opened this issue Apr 6, 2021 · 0 comments · Fixed by #1288

Comments

@nponeccop
Copy link

nponeccop commented Apr 6, 2021

Bug Report

It's a difference in behavior between serverless-offline and real AWS APIGateway V2 aka events.httpApi.

Expected Behavior

event.headers.content-type property is lowercased even if it's passed by curl as cOnteNt-type: , because AWS lowercases it.

Current Behavior

event.headers.content-type arrives the same way an HTTP client passed it. E.g. curl --no-progress-meter -X POST -d '{ "code": 2}' -H 'Content-type: application/json' would be capitalized in the event object.

By contrast, AWS always normalizes it to lowercase content-type.

I'm not aware whether http or headers other than content-type are affected too

Sample Code

It works in the aws-nodejs template, with http replaced by httpApi. I can provide with a repo should a need arise, but it's really simple.

nponeccop added a commit to nponeccop/serverless-openapi-templates that referenced this issue Apr 6, 2021
See dherault/serverless-offline#1207

The old schema worked offline, but failed with the real thing
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 a pull request may close this issue.

2 participants