diff --git a/lib/adapters/http.js b/lib/adapters/http.js index 395dd1c..de68369 100644 --- a/lib/adapters/http.js +++ b/lib/adapters/http.js @@ -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, @@ -53,7 +59,7 @@ module.exports = function httpAdapter(resolve, reject, config) { method: config.method, headers: headers, agent: config.agent, - auth: auth + auth: auth || parsed.auth, }; // Create the request