-
Notifications
You must be signed in to change notification settings - Fork 288
Closed
Description
When using option rejectPublicSuffixes: true
(the default), trying to set a cookie with Domain=localhost
throws the error Cookie has domain set to a public suffix
, which I believe is incorrect.
How to reproduce
Run the following code with the latest master of tough-cookie (commit 1b25269)
const { CookieJar } = require("../lib/cookie");
const cookieJar = new CookieJar();
cookieJar.setCookieSync("a=b; Domain=localhost", "http://localhost") // throws 'Error: Cookie has domain set to a public suffix'
Expected result
I can set cookies with Domain=localhost
without an error.
Workaround
Turning off the rejectPublicSuffixes
option when creating the CookieJar
causes the cookie to be set without errors, as expected.
Metadata
Metadata
Assignees
Labels
No labels