Skip to content

Commit

Permalink
Added default headers for chromium in direct requests (#1765)
Browse files Browse the repository at this point in the history
  • Loading branch information
ninadbstack authored Oct 24, 2024
1 parent 7cabfba commit c0e5870
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/core/src/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('; ')
};

Expand Down

0 comments on commit c0e5870

Please sign in to comment.