mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
fix(Network): Do not attempt to normalize malformed URLs. (#875)
This patch avoids throwing 'url malformed' error during generating request hash for request interception. Fixes #869.
This commit is contained in:
@@ -394,9 +394,16 @@ helper.tracePublicAPI(Response);
|
||||
* @return {string}
|
||||
*/
|
||||
function generateRequestHash(request) {
|
||||
const hash = {
|
||||
let normalizedURL = request.url;
|
||||
try {
|
||||
// Decoding is necessary to normalize URLs. @see crbug.com/759388
|
||||
url: decodeURI(request.url),
|
||||
// The method will throw if the URL is malformed. In this case,
|
||||
// consider URL to be normalized as-is.
|
||||
normalizedURL = decodeURI(request.url);
|
||||
} catch (e) {
|
||||
}
|
||||
const hash = {
|
||||
url: normalizedURL,
|
||||
method: request.method,
|
||||
postData: request.postData,
|
||||
headers: {},
|
||||
|
||||
Reference in New Issue
Block a user