sveltejs / sveltejs/kit

Cookies in universal load function

Open
#11,828 16 comments 15 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Describe the problem

Currently cookies are only available in +page.server.ts and +layout.server.ts but not in the universal load variants.

Describe the proposed solution

Make cookies available in universal load(). Only cookies with httpOnly disabled may be accessed, so that the universal load() function behaves the same in whichever environment it is executed.

Alternatives considered

No response

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 cookies are exposed to +page.server.ts and +layout.server.ts, then compare that with the universal load variants described in the issue. Verify the handling of httpOnly cookies across server and client execution, and consider tests covering both environments. Done means universal load() can access non-httpOnly cookies consistently without exposing protected cookies.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
full-stack
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.