提交 32a90439 编写于 作者: H Harry Lachenmayer 提交者: Idan Gazit

Add HTTP basic authentication.

上级 4bbde9ae
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册