From dee1ba29d563e024afcfc1d76bab7f4d8ccce58f Mon Sep 17 00:00:00 2001 From: Artem Derevnjuk Date: Mon, 7 Jun 2021 16:54:34 +0300 Subject: [PATCH] fix(parser): decode separators if they are encoded (#8) closes #5 --- lib/parser.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/parser.js b/lib/parser.js index 8c87eda..12238ec 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -9,7 +9,9 @@ function parseHttpVersion (response) { function parseRedirectUrl (response) { if (response && response.statusCode >= 300 && response.statusCode < 400) { var location = encodingUtil.transformBinaryToUtf8(response.headers['location']); + if (location) { + location = decodeURIComponent(location); var hasRelativeProtocol = location.startsWith('//'); var isRelativeUrl = !hasRelativeProtocol && /^\.*\//.test(location); var base = response.request.uri;