Skip to content

feat(events): add MultiValueHeaders to LambdaFunctionURLResponse#628

Open
nghiack7 wants to merge 1 commit intoaws:mainfrom
nghiack7:feat/lambda-url-response-multi-value-headers
Open

feat(events): add MultiValueHeaders to LambdaFunctionURLResponse#628
nghiack7 wants to merge 1 commit intoaws:mainfrom
nghiack7:feat/lambda-url-response-multi-value-headers

Conversation

@nghiack7
Copy link
Copy Markdown

@nghiack7 nghiack7 commented May 9, 2026

Problem

LambdaFunctionURLResponse only has a single-value Headers map[string]string, which makes it impossible to set more than one value for the same header key — the most common case being multiple Set-Cookie headers.

The equivalent response types (APIGatewayProxyResponse, APIGatewayV2HTTPResponse) already have MultiValueHeaders map[string][]string for this exact reason.

Closes #556

Changes

  • Added MultiValueHeaders map[string][]string \json:"multiValueHeaders,omitempty"`toLambdaFunctionURLResponse`, matching the shape of the existing gateway response types.
  • Added a round-trip marshaling test (TestLambdaFunctionURLResponseMultiValueHeadersMarshaling) with a fixture containing a multi-cookie Set-Cookie header.

Testing

go test ./events/ -run TestLambdaFunctionURL -v

All existing tests continue to pass. New test exercises the multi-value path.

AWS Lambda Function URLs can return multiple values for the same header
key (e.g. multiple Set-Cookie headers). Without MultiValueHeaders, callers
had to work around the single-value Headers map and could not set more than
one cookie in a single response.

Adds MultiValueHeaders map[string][]string with omitempty, matching the
shape already present on APIGatewayProxyResponse and
APIGatewayV2HTTPResponse, and adds a round-trip marshaling test with a
multi-cookie fixture.

Fixes aws#556
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.12%. Comparing base (815d21f) to head (86e7cdf).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #628   +/-   ##
=======================================
  Coverage   75.12%   75.12%           
=======================================
  Files          36       36           
  Lines        1419     1419           
=======================================
  Hits         1066     1066           
  Misses        274      274           
  Partials       79       79           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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 this pull request may close these issues.

Implement MultiValueHeaders for events.LambdaFunctionURLResponse

2 participants