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:
Andrey Lushnikov
2017-09-29 08:29:19 +09:00
committed by GitHub
parent ec760ab5e3
commit cfece3451d
2 changed files with 16 additions and 2 deletions

View File

@@ -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: {},