fix: case-insensitive header lookup in parseBody - #378
Merged
Conversation
HTTP header names are case-insensitive per RFC 9110 §5.1. API Gateway REST (v1) proxy integrations pass headers with the client's original casing. The parseBody function previously did a direct bracket access for 'content-type' (lowercase only), which missed canonically-cased 'Content-Type' headers — silently passing an unparsed string body to handlers that expect a parsed object. Added a headerValue helper that finds headers case-insensitively and applied it to both parseBody (content-type) and corsHeader (origin). Closes #377 Co-authored-by: Thorsten Hoeger <thorsten.hoeger@taimos.de>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This pull request was created by @kiro-agent on behalf of @hoegertn 👻
Comment with /kiro fix to address specific feedback or /kiro all to address everything.
Learn about Kiro Web
Summary
Fixes #377 —
parseBodyused a case-sensitive bracket access (event.headers['content-type']) which missed canonically-casedContent-Typeheaders from API Gateway REST v1 proxy integrations.Changes
headerValuehelper that finds headers case-insensitively (per RFC 9110 §5.1)parseBodyto use the helper forcontent-typelookupcorsHeaderto use the same helper fororiginlookupTesting
tsc --noEmit)