From c7d62c5bcd8c471e6deba2e71bdcd4ab615fc4c8 Mon Sep 17 00:00:00 2001 From: Dinh Le Date: Tue, 29 Sep 2026 15:56:45 +0700 Subject: [PATCH] fix(aws-lambda): omit headers whose value is an empty array `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 --- packages/aws-lambda/src/headers.test.ts | 3 +++ packages/aws-lambda/src/headers.ts | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/aws-lambda/src/headers.test.ts b/packages/aws-lambda/src/headers.test.ts index 5f6706b2..23758457 100644 --- a/packages/aws-lambda/src/headers.test.ts +++ b/packages/aws-lambda/src/headers.test.ts @@ -189,11 +189,14 @@ describe('toLambdaHeaders', () => { 'content-type': 'application/json', 'x-custom': ['one', 'two'], 'x-skipped': undefined, + 'x-empty': [], + 'x-empty-string': '', 'set-cookie': ['foo=bar', 'bar=baz'], })).toEqual([ { 'content-type': 'application/json', 'x-custom': 'one, two', + 'x-empty-string': '', }, ['foo=bar', 'bar=baz'], ]) diff --git a/packages/aws-lambda/src/headers.ts b/packages/aws-lambda/src/headers.ts index 570f3902..58cb4817 100644 --- a/packages/aws-lambda/src/headers.ts +++ b/packages/aws-lambda/src/headers.ts @@ -104,7 +104,7 @@ export function toLambdaHeaders(standardHeaders: StandardHeaders): [ for (const key of Object.keys(standardHeaders)) { const value = standardHeaders[key] - if (value === undefined) { + if (value === undefined || (Array.isArray(value) && value.length === 0)) { continue }