mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
docs(example): simplified overwriting of requests (#3621)
This commit is contained in:
parent
c25dfba878
commit
72b3147d7c
@ -3900,10 +3900,11 @@ Continues route's request with optional overrides.
|
|||||||
```js
|
```js
|
||||||
await page.route('**/*', (route, request) => {
|
await page.route('**/*', (route, request) => {
|
||||||
// Override headers
|
// Override headers
|
||||||
const headers = Object.assign({}, request.headers(), {
|
const headers = {
|
||||||
|
...request.headers(),
|
||||||
foo: 'bar', // set "foo" header
|
foo: 'bar', // set "foo" header
|
||||||
origin: undefined, // remove "origin" header
|
origin: undefined, // remove "origin" header
|
||||||
});
|
};
|
||||||
route.continue({headers});
|
route.continue({headers});
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user