From c0e58707aee142b452481bff66a1a71dba1fa615 Mon Sep 17 00:00:00 2001 From: ninadbstack <60422475+ninadbstack@users.noreply.github.com> Date: Thu, 24 Oct 2024 13:52:00 +0530 Subject: [PATCH] Added default headers for chromium in direct requests (#1765) --- packages/core/src/network.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/core/src/network.js b/packages/core/src/network.js index 2ec510d0a..cd7b22f3c 100644 --- a/packages/core/src/network.js +++ b/packages/core/src/network.js @@ -417,7 +417,18 @@ async function makeDirectRequest(network, request, session) { const { cookies } = await session.send('Network.getCookies', { urls: [request.url] }); let headers = { + // add default browser + accept: '*/*', + 'sec-fetch-site': 'same-origin', + 'sec-fetch-mode': 'cors', + 'sec-fetch-dest': 'font', + 'sec-ch-ua': '"Chromium";v="123", "Google Chrome";v="123", "Not?A_Brand";v="99"', + 'sec-ch-ua-mobile': '?0', + 'sec-ch-ua-platform': '"macOS"', + 'sec-fetch-user': '?1', + // add request fetched headers ...request.headers, + // add applicable cookies cookie: cookies.map(cookie => `${cookie.name}=${cookie.value}`).join('; ') };