mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
Make interception work with redirects (#218)
This patch: - changes interception API so that it better aligns with what we'd like to see in #121 - fixes the issue with redirect interception Fixes #217.
This commit is contained in:
@@ -247,17 +247,23 @@ class InterceptedRequest {
|
||||
});
|
||||
}
|
||||
|
||||
continue() {
|
||||
/**
|
||||
* @param {!Object} overrides
|
||||
*/
|
||||
continue(overrides = {}) {
|
||||
console.assert(!this._handled, 'This request is already handled!');
|
||||
this._handled = true;
|
||||
let headers = {};
|
||||
for (let entry of this.headers.entries())
|
||||
headers[entry[0]] = entry[1];
|
||||
let headers = undefined;
|
||||
if (overrides.headers) {
|
||||
headers = {};
|
||||
for (let entry of overrides.headers.entries())
|
||||
headers[entry[0]] = entry[1];
|
||||
}
|
||||
this._client.send('Network.continueInterceptedRequest', {
|
||||
interceptionId: this._interceptionId,
|
||||
url: this.url,
|
||||
method: this.method,
|
||||
postData: this.postData,
|
||||
url: overrides.url,
|
||||
method: overrides.method,
|
||||
postData: overrides.postData,
|
||||
headers: headers
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user