From e04fc22f5170702ace1d24ba330994565d4afc42 Mon Sep 17 00:00:00 2001 From: Robin Richtsfeld Date: Fri, 7 May 2021 20:14:30 +0200 Subject: [PATCH] feat(requestinterception): don't disable cache by default --- docs/api.md | 2 +- src/common/NetworkManager.ts | 4 ++-- src/common/Page.ts | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/api.md b/docs/api.md index 9bcfe31f38e18..776d05541ff20 100644 --- a/docs/api.md +++ b/docs/api.md @@ -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 diff --git a/src/common/NetworkManager.ts b/src/common/NetworkManager.ts index b07868e97f294..6fd646b601fba 100644 --- a/src/common/NetworkManager.ts +++ b/src/common/NetworkManager.ts @@ -114,7 +114,7 @@ export class NetworkManager extends EventEmitter { _credentials?: Credentials = null; _attemptedAuthentications = new Set(); _userRequestInterceptionEnabled = false; - _userRequestInterceptionCacheSafe = false; + _userRequestInterceptionCacheSafe = true; _protocolRequestInterceptionEnabled = false; _userCacheDisabled = false; _emulatedNetworkConditions: InternalNetworkConditions = { @@ -230,7 +230,7 @@ export class NetworkManager extends EventEmitter { async setRequestInterception( value: boolean, - cacheSafe = false + cacheSafe = true ): Promise { this._userRequestInterceptionEnabled = value; this._userRequestInterceptionCacheSafe = cacheSafe; diff --git a/src/common/Page.ts b/src/common/Page.ts index 0e4e5b4dc775c..ffca315aa635f 100644 --- a/src/common/Page.ts +++ b/src/common/Page.ts @@ -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}, @@ -799,7 +799,7 @@ export class Page extends EventEmitter { */ async setRequestInterception( value: boolean, - cacheSafe = false + cacheSafe = true ): Promise { return this._frameManager .networkManager()