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

fix(interception): Disable newtork caching when intercepting #1154

Merged
merged 1 commit into from
Oct 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1007,6 +1007,8 @@ puppeteer.launch().then(async browser => {
> **NOTE** Request interception doesn't work with data URLs. Calling `abort`,
> `continue` or `respond` on requests for data URLs is a noop.
> **NOTE** Enabling request interception disables page caching.
#### page.setUserAgent(userAgent)
- `userAgent` <[string]> Specific user agent to use in this page
- returns: <[Promise]> Promise which resolves when the user agent is set.
Expand Down
5 changes: 4 additions & 1 deletion lib/NetworkManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,10 @@ class NetworkManager extends EventEmitter {
return;
this._protocolRequestInterceptionEnabled = enabled;
const patterns = enabled ? [{urlPattern: '*'}] : [];
await this._client.send('Network.setRequestInterception', {patterns});
await Promise.all([
this._client.send('Network.setCacheDisabled', {cacheDisabled: enabled}),
this._client.send('Network.setRequestInterception', {patterns})
]);
}

/**
Expand Down