From d1ef1dfc3525147ab40f20b04a054255e173c63b Mon Sep 17 00:00:00 2001 From: Dmitriy Gordienko Date: Wed, 15 Mar 2023 18:05:45 +0300 Subject: [PATCH] catch CookieHandler.getCookies error --- src/core/proxy.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/core/proxy.js b/src/core/proxy.js index 7a67584..9375267 100644 --- a/src/core/proxy.js +++ b/src/core/proxy.js @@ -10,20 +10,20 @@ const requestHandler = async (request, proxy, overrides = {}) => { request.continue(); return; } const cookieHandler = new CookieHandler(request); - // Request options for GOT accounting for overrides - const options = { - cookieJar: await cookieHandler.getCookies(), - method: overrides.method || request.method(), - body: overrides.postData || request.postData(), - headers: overrides.headers || setHeaders(request), - agent: setAgent(proxy), - responseType: "buffer", - maxRedirects: 15, - throwHttpErrors: false, - ignoreInvalidCookies: true, - followRedirect: false - }; try { + // Request options for GOT accounting for overrides + const options = { + cookieJar: await cookieHandler.getCookies(), + method: overrides.method || request.method(), + body: overrides.postData || request.postData(), + headers: overrides.headers || setHeaders(request), + agent: setAgent(proxy), + responseType: "buffer", + maxRedirects: 15, + throwHttpErrors: false, + ignoreInvalidCookies: true, + followRedirect: false + }; const response = await got(overrides.url || request.url(), options); // Set cookies manually because "set-cookie" doesn't set all cookies (?) // Perhaps related to https://github.com/puppeteer/puppeteer/issues/5364