Skip to content

Commit

Permalink
docs(api.md): add example to override request headers (#3475)
Browse files Browse the repository at this point in the history
References #3458.
  • Loading branch information
aslushnikov committed Nov 1, 2018
1 parent 2a88690 commit 8e93eab
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/api.md
Expand Up @@ -3063,6 +3063,18 @@ Exception is immediately thrown if the request interception is not enabled.
Continues request with optional request overrides. To use this, request interception should be enabled with `page.setRequestInterception`.
Exception is immediately thrown if the request interception is not enabled.

```js
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});
});
```

#### request.failure()
- returns: <?[Object]> Object describing request failure, if any
- `errorText` <[string]> Human-readable error message, e.g. `'net::ERR_FAILED'`.
Expand Down

0 comments on commit 8e93eab

Please sign in to comment.