Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

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

Max Schmitt72b3147d7c75
diff --git a/docs/api.md b/docs/api.md
index e61bb52b1e..af244348c6 100644
--- a/docs/api.md
+++ b/docs/api.md
@@ -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});
});
```