Skip to content

Commit

Permalink
fix: allow set cookies with localhost
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
colincasey committed Aug 25, 2022
1 parent 8b06ee7 commit ea0ea0c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/pubsuffix-psl.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function getPublicSuffix(domain, options = {}) {

if (!ignoreError && SPECIAL_USE_DOMAINS.includes(topLevelDomain)) {
if (allowSpecialUseDomain) {
return "";
return topLevelDomain;
}
throw new Error(
`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}.`
Expand Down

0 comments on commit ea0ea0c

Please sign in to comment.