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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user