Skip to content
This repository has been archived by the owner on Dec 3, 2021. It is now read-only.

Commit

Permalink
fix(parser): decode separators if they are encoded (#8)
Browse files Browse the repository at this point in the history
closes #5
  • Loading branch information
derevnjuk authored Jun 7, 2021
1 parent 839a851 commit dee1ba2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit dee1ba2

Please sign in to comment.