sveltejs / sveltejs/kit

setHeaders should have a way to append instead of overwrite

Open
#12,053 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the problem

When using setHeaders for setting the Link header, it overwrites the current Link header that is generated by Sveltekit.

Describe the proposed solution

setHeaders should have a way to append to the current headers instead of overwriting them.

Alternatives considered

It could be done from within hooks, but I have different Link header depending on the page, so it would be easier to manage that in +page.server.ts or +layout.server.ts.

Importance

would make my life easier

Additional Information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how setHeaders is handled for +page.server.ts and +layout.server.ts, then inspect how SvelteKit generates Link headers. Determine how an append option should preserve existing headers while allowing page-specific Link values, and verify the behavior against the relevant server-side header handling tests if available.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend, web-dev
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.