You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix multiple cookies with same name but different paths/domains
- Add generate_cookie_key function to create unique keys from domain/path/name
- Extend cookies.get() to accept optional domain and path options in opts parameter
- Store cookies with unique keys to prevent overwrites
- Maintain backward compatibility with existing API usage
- Add comprehensive tests for new functionality
- Address review feedback from PR #14056
Co-authored-by: Rich-Harris <[email protected]>
fix: support multiple cookies with the same name across different paths and domains
6
+
7
+
Fixes issue where setting multiple cookies with the same name but different paths would overwrite each other. Now cookies are stored with unique keys based on domain, path, and name, allowing proper handling of multiple cookies with identical names but different scopes.
8
+
9
+
The `cookies.get()` method has been extended to accept optional `domain` and `path` options to retrieve specific cookies:
Copy file name to clipboardExpand all lines: packages/kit/src/exports/public.d.ts
+5-2Lines changed: 5 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -212,9 +212,12 @@ export interface Cookies {
212
212
/**
213
213
* Gets a cookie that was previously set with `cookies.set`, or from the request headers.
214
214
* @param name the name of the cookie
215
-
* @param opts the options, passed directly to `cookie.parse`. See documentation [here](https://github.com/jshttp/cookie#cookieparsestr-options)
215
+
* @param opts the options, domain and path are used to find the cookie, and passed directly to `cookie.parse`. See documentation [here](https://github.com/jshttp/cookie#cookieparsestr-options)
* Gets a cookie that was previously set with `cookies.set`, or from the request headers.
191
191
* @param name the name of the cookie
192
-
* @param opts the options, passed directly to `cookie.parse`. See documentation [here](https://github.com/jshttp/cookie#cookieparsestr-options)
192
+
* @param opts the options, domain and path are used to find the cookie, and passed directly to `cookie.parse`. See documentation [here](https://github.com/jshttp/cookie#cookieparsestr-options)
0 commit comments