Repository navigation
docs(core): stop showing flattenStandardHeader on set-cookie - #159
Conversation
The header helpers example flattened `set-cookie` into `'a=1, b=2'`. Copied into an adapter that writes one value per header, that sends a single folded Set-Cookie line, which browsers parse as one cookie, so attributes such as HttpOnly can be lost and later cookies dropped. Show the helper on a multi-value `vary` header instead, warn that it must not be used for `set-cookie`, and add a JSDoc note on the helper. A README regression test keeps the docs from flattening `set-cookie` again. Runtime behavior is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016RHRvK3Kt3oPLgn8Tmk85r
Move the README warning into a WARNING callout like the rest of the README, and link to the AWS Lambda adapter's docs instead of restating how `toLambdaHeaders()` handles cookies. Shorten the JSDoc to two lines to match its neighbours. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016RHRvK3Kt3oPLgn8Tmk85r
Remove the README callout and the JSDoc note; the example already shows the helper on `vary` instead of `set-cookie`. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016RHRvK3Kt3oPLgn8Tmk85r
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016RHRvK3Kt3oPLgn8Tmk85r
@standard-server/aws-lambda
@standard-server/core
@standard-server/fastify
@standard-server/fetch
@standard-server/node
@standard-server/peer
@standard-server/shared
commit: |
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
|
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — a docs-only update to the "Header helpers" example in packages/core/README.md.
flattenStandardHeadernow demonstrated onvary— the example addsvary: 'accept'/vary: 'accept-encoding'to the inputs, documents the merged output as['accept', 'accept-encoding'], and flattens it to'accept, accept-encoding'. I traced both functions:mergeStandardHeadersconcatenates duplicate keys viatoArray(utils.ts:167) andflattenStandardHeaderjoins arrays with', '(utils.ts:76), so the documented result is exact.- Dropping the
set-cookieflattening demo — usingset-cookieforflattenStandardHeaderwas misleading (Set-Cookie is not a comma-joinable list), sovaryis a genuinely better illustration.
The omitted warning: undefined in the output comment is intentional — it demonstrates that undefined values are dropped.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
flattenStandardHeader on set-cookie

Summary
Updated the documentation example for
mergeStandardHeadersandflattenStandardHeaderfunctions to better illustrate how these utilities handle multi-value headers.Changes
varyheader across multiple objects, showing how it correctly combines values into an arrayvary: 'accept'to show the merge behaviorvaryvalue from'accept'to'accept-encoding'to demonstrate combining different valuesvaryas an array['accept', 'accept-encoding']instead of a single stringset-cookieflattening tovaryflattening, providing a clearer illustration of theflattenStandardHeaderfunction with the multi-value headerDetails
These changes clarify how the header merging functions handle headers that can have multiple values, making the documentation more accurate and helpful for users understanding the behavior of these utilities.
https://claude.ai/code/session_016RHRvK3Kt3oPLgn8Tmk85r