Skip to content

docs(core): stop showing flattenStandardHeader on set-cookie - #159

Merged
dinwwwh merged 4 commits into
mainfrom
claude/brave-pasteur-e7z0fk
Oct 13, 2026
Merged

dinwwwh merged 4 commits into
mainfrom
claude/brave-pasteur-e7z0fk

Conversation

@dinwwwh

@dinwwwh dinwwwh commented Oct 13, 2026

Copy link
Copy Markdown
Member

Summary

Updated the documentation example for mergeStandardHeaders and flattenStandardHeader functions to better illustrate how these utilities handle multi-value headers.

Changes

  • Modified the example to demonstrate merging of the vary header across multiple objects, showing how it correctly combines values into an array
  • Updated the first input object to include vary: 'accept' to show the merge behavior
  • Changed the second input object's vary value from 'accept' to 'accept-encoding' to demonstrate combining different values
  • Updated the expected output to show vary as an array ['accept', 'accept-encoding'] instead of a single string
  • Changed the final example from demonstrating set-cookie flattening to vary flattening, providing a clearer illustration of the flattenStandardHeader function with the multi-value header

Details

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

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
@pkg-pr-new

pkg-pr-new Bot commented Oct 13, 2026

Copy link
Copy Markdown
@standard-server/aws-lambda

npm i https://pkg.pr.new/@standard-server/aws-lambda@159

@standard-server/core

npm i https://pkg.pr.new/@standard-server/core@159

@standard-server/fastify

npm i https://pkg.pr.new/@standard-server/fastify@159

@standard-server/fetch

npm i https://pkg.pr.new/@standard-server/fetch@159

@standard-server/node

npm i https://pkg.pr.new/@standard-server/node@159

@standard-server/peer

npm i https://pkg.pr.new/@standard-server/peer@159

@standard-server/shared

npm i https://pkg.pr.new/@standard-server/shared@159

commit: b7d6289

@codecov

codecov Bot commented Oct 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@codspeed

codspeed Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

⚠️ 5 benchmarks spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

ℹ️ 16 benchmarks have no flame graph

The flamegraph could not be generated because too much time was spent in runtime internals, making the visualization not useful for performance analysis.

✅ 26 untouched benchmarks
⏩ 108 skipped benchmarks1


Comparing claude/brave-pasteur-e7z0fk (b7d6289) with main (31a8ef3)

Open in CodSpeed

Footnotes

  1. 108 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes — a docs-only update to the "Header helpers" example in packages/core/README.md.

  • flattenStandardHeader now demonstrated on vary — the example adds vary: '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: mergeStandardHeaders concatenates duplicate keys via toArray (utils.ts:167) and flattenStandardHeader joins arrays with ', ' (utils.ts:76), so the documented result is exact.
  • Dropping the set-cookie flattening demo — using set-cookie for flattenStandardHeader was misleading (Set-Cookie is not a comma-joinable list), so vary is a genuinely better illustration.

The omitted warning: undefined in the output comment is intentional — it demonstrates that undefined values are dropped.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@dinwwwh dinwwwh changed the title Update mergeStandardHeaders documentation example docs(core): stop showing flattenStandardHeader on set-cookie Oct 13, 2026
@dinwwwh
dinwwwh merged commit 28b8518 into main Oct 13, 2026
11 checks passed
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.

2 participants