Skip to content

Commit ea0ea0c

Browse files
committed
fix: allow set cookies with localhost
Adding more tests to cover the breaking use cases noted in #246. e.g.;. * `new CookieJar().setCookieSync("settingThisShouldPass=true; Domain=localhost; Path=/;", "http://localhost")` Also modifies the assertion for a test introduced in #221 that may be incorrect.
1 parent 8b06ee7 commit ea0ea0c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/pubsuffix-psl.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function getPublicSuffix(domain, options = {}) {
6060

6161
if (!ignoreError && SPECIAL_USE_DOMAINS.includes(topLevelDomain)) {
6262
if (allowSpecialUseDomain) {
63-
return "";
63+
return topLevelDomain;
6464
}
6565
throw new Error(
6666
`Cookie has domain set to the public suffix "${topLevelDomain}" which is a special use domain. To allow this, configure your CookieJar with {allowSpecialUseDomain:true, rejectPublicSuffixes: false}.`

0 commit comments

Comments
 (0)