Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed usage of deprecated API #348

Merged
merged 1 commit into from
Aug 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/needle.js
Original file line number Diff line number Diff line change
Expand Up @@ -549,8 +549,9 @@ Needle.prototype.send_request = function(count, method, uri, config, post_data,

config.headers['host'] = null; // clear previous Host header to avoid conflicts.

debug('Redirecting to ' + url.resolve(uri, headers.location));
return self.send_request(++count, method, url.resolve(uri, headers.location), config, post_data, out, callback);
let redirect_url = new url.URL(headers.location, uri);
debug('Redirecting to ' + redirect_url.toString());
return self.send_request(++count, method, redirect_url.toString(), config, post_data, out, callback);
} else if (config.follow_max > 0) {
return done(new Error('Max redirects reached. Possible loop in: ' + headers.location));
}
Expand Down