2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-11 18:02:32 +03:00

Merge pull request #252 from ajcrites/basic-auth-245

Fixing 245: Basic auth for node http adapter
This commit is contained in:
Matt Zabriskie
2016-03-02 12:31:09 -07:00
2 changed files with 21 additions and 1 deletions
+6
View File
@@ -46,6 +46,12 @@ module.exports = function httpAdapter(resolve, reject, config) {
// Parse url
var parsed = url.parse(config.url);
if (!auth && parsed.auth) {
var urlAuth = parsed.auth.split(':');
var urlUsername = urlAuth[0] || '';
var urlPassword = urlAuth[1] || '';
auth = urlUsername + ':' + urlPassword;
}
var options = {
hostname: parsed.hostname,
port: parsed.port,