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

feat(requestinterception): don't disable cache by default #7215

Closed
wants to merge 1 commit into from
Closed
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: 1 addition & 1 deletion docs/api.md
Expand Up @@ -2219,7 +2219,7 @@ await page.setGeolocation({ latitude: 59.95, longitude: 30.31667 });
#### page.setRequestInterception(value[, cacheSafe])

- `value` <[boolean]> Whether to enable request interception.
- `cacheSafe` <[boolean]> Whether to trust browser caching. If set to false, enabling request interception disables page caching. Defaults to false.
- `cacheSafe` <[boolean]> Whether to trust browser caching. If set to false, enabling request interception disables page caching. Defaults to true.
- returns: <[Promise]>

Activating request interception enables `request.abort`, `request.continue` and
Expand Down
4 changes: 2 additions & 2 deletions src/common/NetworkManager.ts
Expand Up @@ -114,7 +114,7 @@ export class NetworkManager extends EventEmitter {
_credentials?: Credentials = null;
_attemptedAuthentications = new Set<string>();
_userRequestInterceptionEnabled = false;
_userRequestInterceptionCacheSafe = false;
_userRequestInterceptionCacheSafe = true;
_protocolRequestInterceptionEnabled = false;
_userCacheDisabled = false;
_emulatedNetworkConditions: InternalNetworkConditions = {
Expand Down Expand Up @@ -230,7 +230,7 @@ export class NetworkManager extends EventEmitter {

async setRequestInterception(
value: boolean,
cacheSafe = false
cacheSafe = true
): Promise<void> {
this._userRequestInterceptionEnabled = value;
this._userRequestInterceptionCacheSafe = cacheSafe;
Expand Down
4 changes: 2 additions & 2 deletions src/common/Page.ts
Expand Up @@ -767,7 +767,7 @@ export class Page extends EventEmitter {
/**
* @param value - Whether to enable request interception.
* @param cacheSafe - Whether to trust browser caching. If set to false,
* enabling request interception disables page caching. Defaults to false.
* enabling request interception disables page caching. Defaults to true.
*
* @remarks
* Activating request interception enables {@link HTTPRequest.abort},
Expand Down Expand Up @@ -799,7 +799,7 @@ export class Page extends EventEmitter {
*/
async setRequestInterception(
value: boolean,
cacheSafe = false
cacheSafe = true
): Promise<void> {
return this._frameManager
.networkManager()
Expand Down