-
-
Notifications
You must be signed in to change notification settings - Fork 170
Open
Description
It seems that the parses wants key=value pairs and ignores the HttpOnly; Secure; settings?
import cookie from 'cookie';
const cookieStr = "MY_COOKIE=somevalue; Path=/; Expires=Tue, 29 Oct 2024 06:06:46 GMT; HttpOnly; Secure; SameSite=None";
const parsedCookie = cookie.parse(cookieStr, { decode: String });
console.log("parsedCookie", parsedCookie);
Result: (missing the HttpOnly and Secure settings?
parsedCookie C <[Object: null prototype] {}> {
MY_COOKIE: 'somevalue',
Path: '/',
Expires: 'Tue, 29 Oct 2024 06:06:46 GMT',
SameSite: 'None'
}
Expected result:
parsedCookie C <[Object: null prototype] {}> {
MY_COOKIE: 'somevalue',
Path: '/',
Expires: 'Tue, 29 Oct 2024 06:06:46 GMT',
HttpOnly: 'true',
Secure: 'true',
SameSite: 'None'
}
if the cookie value is explicit: HttpOnly=true; Secure=true
const cookieStr = "MY_COOKIE=somevalue; Path=/; Expires=Tue, 29 Oct 2024 06:06:46 GMT; HttpOnly=true; Secure=true;
then is parses correctly.
I tried 0.7.2 and 1.0.1. Am I missing something?
anasshakil
Metadata
Metadata
Assignees
Labels
No labels