mirror of
https://github.com/tenrok/axios.git
synced 2026-06-20 20:00:40 +03:00
Dropping support for auth.user/pass
Only accept `username` and `password` as arguments
This commit is contained in:
@@ -218,11 +218,9 @@ These are the available config options for making requests. Only the `url` is re
|
|||||||
// `auth` indicates that HTTP Basic auth should be used, and supplies credentials.
|
// `auth` indicates that HTTP Basic auth should be used, and supplies credentials.
|
||||||
// This will set an `Authorization` header, overwriting any existing
|
// This will set an `Authorization` header, overwriting any existing
|
||||||
// `Authorization` custom headers you have set using `headers`.
|
// `Authorization` custom headers you have set using `headers`.
|
||||||
// The username can be supplied as `user` or `username`
|
|
||||||
// The password can be supplied as `pass` or `password`
|
|
||||||
auth: {
|
auth: {
|
||||||
user: 'janedoe',
|
username: 'janedoe',
|
||||||
pass: 's00pers3cret'
|
password: 's00pers3cret'
|
||||||
}
|
}
|
||||||
|
|
||||||
// `responseType` indicates the type of data that the server will respond with
|
// `responseType` indicates the type of data that the server will respond with
|
||||||
|
|||||||
+2
-2
@@ -41,9 +41,9 @@ module.exports = function xhrAdapter(resolve, reject, config) {
|
|||||||
|
|
||||||
// HTTP basic authentication
|
// HTTP basic authentication
|
||||||
if (config.auth) {
|
if (config.auth) {
|
||||||
var username = config.auth.user || config.auth.username || '';
|
|
||||||
var password = config.auth.pass || config.auth.password || '';
|
|
||||||
requestHeaders['Authorization'] = 'Basic: ' + window.btoa(username + ':' + password);
|
requestHeaders['Authorization'] = 'Basic: ' + window.btoa(username + ':' + password);
|
||||||
|
var username = config.auth.username || '';
|
||||||
|
var password = config.auth.password || '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the request
|
// Create the request
|
||||||
|
|||||||
Reference in New Issue
Block a user