docs(example): simplified overwriting of requests (#3621)

This commit is contained in:
Max Schmitt 2020-08-25 19:37:45 +02:00 committed by GitHub
parent c25dfba878
commit 72b3147d7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3900,10 +3900,11 @@ Continues route's request with optional overrides.
```js
await page.route('**/*', (route, request) => {
// Override headers
const headers = Object.assign({}, request.headers(), {
const headers = {
...request.headers(),
foo: 'bar', // set "foo" header
origin: undefined, // remove "origin" header
});
};
route.continue({headers});
});
```