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;