fix(aws-lambda): omit headers whose value is an empty array - #130
Conversation
`toLambdaHeaders` joined array values with `', '`, so a header set to `[]` was sent as an empty header instead of being left out. It is now skipped, matching the fetch adapter. An explicit `''` string is still sent. Co-Authored-By: Claude <noreply@anthropic.com>
@standard-server/aws-lambda
@standard-server/core
@standard-server/fastify
@standard-server/fetch
@standard-server/node
@standard-server/peer
@standard-server/shared
commit: |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Omit empty-array headers in the Lambda adapter —
toLambdaHeadersnow skips a header whose value is[]instead of serializing it asx-foo: ""; an explicitly empty string is still sent. - Test coverage — the
toLambdaHeaderscase adds'x-empty': [](asserted omitted) and'x-empty-string': ''(asserted kept), so the new branch is pinned and the[]assertion fails againstmain.
The guard matches the fetch adapter's behavior (toFetchHeaders appends nothing for an empty array), and the set-cookie branch is unaffected since [] already contributed no cookies. The change is minimal and well-covered.
DeepSeek Flash (default — pick a model for stronger reviews) | 𝕏
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Merging this PR will not alter performance
Comparing Footnotes
|

The aws-lambda adapter no longer sends a header whose value is
[]as an empty header (x-foo: "").toLambdaHeadersjoined array values with', ', and[].join(', ')is''. Now an empty array means the header is left out, as the fetch adapter already does.Fixes
[]is now omitted from the Lambda response metadata. It used to be sent with an empty value.''is still sent as an empty header.Testing
toLambdaHeaderstest now covers[]and''values. The[]case fails againstmain.vitest run packages/aws-lambda(100 passed),eslintandtscare clean.🤖 Generated with Claude Code