diff --git a/packages/kit/src/runtime/server/cookie.js b/packages/kit/src/runtime/server/cookie.js index ddefa847a432..7c854056d383 100644 --- a/packages/kit/src/runtime/server/cookie.js +++ b/packages/kit/src/runtime/server/cookie.js @@ -67,8 +67,8 @@ export function get_cookies(request, url, trailing_slash) { return c.value; } - const decoder = opts?.decode || decodeURIComponent; - const req_cookies = parse(header, { decode: decoder }); + // `parse` uses default decoder if `opts.decode` is undefined + const req_cookies = parse(header, { decode: opts?.decode }); const cookie = req_cookies[name]; // the decoded string or undefined // in development, if the cookie was set during this session with `cookies.set`, @@ -95,8 +95,8 @@ export function get_cookies(request, url, trailing_slash) { * @param {import('cookie').CookieParseOptions} opts */ getAll(opts) { - const decoder = opts?.decode || decodeURIComponent; - const cookies = parse(header, { decode: decoder }); + // `parse` uses default decoder if `opts.decode` is undefined + const cookies = parse(header, { decode: opts?.decode }); for (const c of Object.values(new_cookies)) { if (