Open kosmotema opened 2 months ago
Current behavior
parseSetCookie ignores the Max-Age attribute when parsing a cookie. For example, this code:
parseSetCookie
import { parseSetCookie } from "@edge-runtime/cookies"; console.log(parseSetCookie("foo=bar; Max-Age=86400; Path=/; SameSite=none; HttpOnly; Secure"));
will output the following to the console:
{ name: 'foo', value: 'bar', httpOnly: true, path: '/', sameSite: 'none', secure: true }
Expected behavior/code
The above code sample should output:
{ name: 'foo', value: 'bar', httpOnly: true, maxAge: 86400, path: '/', sameSite: 'none', secure: true }
Possible solution
Since the Max-Age attribute (unlike the others) contains a hyphen in its name, here should be something like "max-age": maxage
Max-Age
"max-age": maxage
Made a fix https://github.com/vercel/edge-runtime/pull/995
Bug Report
Current behavior
parseSetCookie
ignores the Max-Age attribute when parsing a cookie. For example, this code:will output the following to the console:
Expected behavior/code
The above code sample should output:
Possible solution
Since the
Max-Age
attribute (unlike the others) contains a hyphen in its name, here should be something like"max-age": maxage