Merge pull request #5 from sliterok/patch-1
Moved definition of CookieJar.cookies because it caused TypeError on constructor
This commit is contained in:
commit
7d3393d9e5
|
@ -5,6 +5,8 @@ import {paramError, CookieParseError} from "./errors.mjs";
|
||||||
|
|
||||||
export default class CookieJar {
|
export default class CookieJar {
|
||||||
constructor(file, flags = "rw", cookies, cookieIgnoreCallback) {
|
constructor(file, flags = "rw", cookies, cookieIgnoreCallback) {
|
||||||
|
this.cookies = new Map();
|
||||||
|
|
||||||
if(file && typeof file !== "string")
|
if(file && typeof file !== "string")
|
||||||
throw paramError("Second", "file", "new CookieJar()", "string");
|
throw paramError("Second", "file", "new CookieJar()", "string");
|
||||||
if(typeof flags !== "string")
|
if(typeof flags !== "string")
|
||||||
|
@ -22,7 +24,6 @@ export default class CookieJar {
|
||||||
throw paramError("Fourth", "cookieIgnoreCallback", "new CookieJar()", "function");
|
throw paramError("Fourth", "cookieIgnoreCallback", "new CookieJar()", "function");
|
||||||
this.file = file;
|
this.file = file;
|
||||||
this.flags = flags;
|
this.flags = flags;
|
||||||
this.cookies = new Map();
|
|
||||||
this.cookieIgnoreCallback = cookieIgnoreCallback;
|
this.cookieIgnoreCallback = cookieIgnoreCallback;
|
||||||
}
|
}
|
||||||
addCookie(cookie, fromURL) {
|
addCookie(cookie, fromURL) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user