Hi there,
I am trying to add header with xk6-browser, refer to the doc Page | Playwright
the param “referer” use the string format. but with "page.setExtraHTTPHeaders(headers);
" it needs to pass an object as the param.
So I am trying to pass the header as an object, but it seems not work
Here’s my code, does anyone know which step I did incorrectly?
export function test() {
const param = {
headers: {
'Content-Type': 'application/json',
origin: env.domain,
},
cookies: {
// cookies here
},
};
const browser = chromium.launch({ headless: false });
const page = browser.newPage();
page
.goto('https://puce.nzxt.com', { waitUntil: 'networkidle', referer: param })
.then(() => {
// do something