-
-
Notifications
You must be signed in to change notification settings - Fork 968
Closed
Labels
bugSomething does not work as it shouldSomething does not work as it shouldenhancementThis change will extend Got featuresThis change will extend Got features✭ help wanted ✭
Description
Since this commit in tough-cookie (salesforce/tough-cookie@d5d6f79#diff-d721bcd439ec1bdd00213161a426ebd8 , code below) the following line to check the cookieJar won't work anymore:
got/source/normalize-arguments.ts
Line 171 in 62b3388
if (setCookie.length === 4 && getCookieString.length === 0) { |
as the code in tough-cookie patches the prototype so the length of all the methods will always return 0.
The workaround provided here #1082 will also work here.
-- one more workaround:
function proxy(org, proxifier) {
return new Proxy(proxifier(org), {
get: (obj, prop) => (prop in obj ? obj[prop] : org[prop])
});
}
const cookies = proxy(new CookieJar(), obj => {
return {
setCookie: async (rawCookie, url) => obj.setCookie(rawCookie, url, console.log),
getCookieString: async url => obj.getCookieString(url)
};
});
const resp = await got("https://google.com", { cookieJar: cookies });
szmarczak, eugeneware, tongrhj, scttcper, SleepWalker and 1 more
Metadata
Metadata
Assignees
Labels
bugSomething does not work as it shouldSomething does not work as it shouldenhancementThis change will extend Got featuresThis change will extend Got features✭ help wanted ✭