diff --git a/lib/adapters/xhr.js b/lib/adapters/xhr.js index 5cf5429..4fc7b86 100644 --- a/lib/adapters/xhr.js +++ b/lib/adapters/xhr.js @@ -39,10 +39,17 @@ module.exports = function xhrAdapter(resolve, reject, config) { xDomain = true; } + // HTTP basic authentication + var configAuth = config.auth || {}; + var auth = { + username: configAuth.username || configAuth.user || '', + password: configAuth.password || configAuth.pass || '' + }; + // Create the request var request = new adapter('Microsoft.XMLHTTP'); - request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true); - + request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true, auth.username, auth.password); + // Set the request timeout in MS request.timeout = config.timeout;