Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation example for removing header doesn't remove header #4743

Closed
rmzg opened this issue Jul 22, 2019 · 1 comment · Fixed by #4797
Closed

Documentation example for removing header doesn't remove header #4743

rmzg opened this issue Jul 22, 2019 · 1 comment · Fixed by #4797

Comments

@rmzg
Copy link
Contributor

rmzg commented Jul 22, 2019

The API.md page has the following example:

await page.setRequestInterception(true);
page.on('request', request => {
  // Override headers
  const headers = Object.assign({}, request.headers(), {
    foo: 'bar', // set "foo" header
    origin: undefined, // remove "origin" header
  });
  request.continue({headers});
});

When the example is executed as follows:

req.continue({headers:{'pragma': undefined}});

The actual headers look like:

Connection: keep-alive
Pragma: undefined
Cache-Control: no-cache
Referer: http://www.google.com/
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/77.0.3835.0 Safari/537.36

Notice that Pragma is still there, merely its value replaced.

@fastjien
Copy link

i have the same issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants