edge-runtime
edge-runtime copied to clipboard
feat: add @edge-runtime/cookies helpers
This provides utilities to handle with cookie parsing & manipulating with Request/Response objects.
The code was copied from the Next.js repo, to provide these utilities to other frameworks so they can reuse this logic when they deploy to any Edge Runtime-compatible service.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Updated |
|---|---|---|---|
| edge-runtime | ✅ Ready (Inspect) | Visit Preview | Aug 23, 2022 at 11:18AM (UTC) |
discussion:
I feel like Cookies can have a better API, or at least a .commit(headers) method (or, commit(cookies, headers) function) that will make ManipulateHeadersCookies much simpler.
Maybe even
type CookiesOptions = {
onCookieChanges(name: string, value: string, options: CookieOptions): void
};
class Cookies extends Map<string, string> {
constructor(cookieHeader: string | null | undefined, private readonly options: CookiesOptions) {
// ...
}
}
🤔
I'm gonna open a new PR for this