mirror of
https://github.com/tenrok/axios.git
synced 2026-06-20 20:00:40 +03:00
Polyfilling btoa where appropriate
Includes testing of the polyfills.
This commit is contained in:
+2
-1
@@ -8,6 +8,7 @@ var buildURL = require('./../helpers/buildURL');
|
||||
var parseHeaders = require('./../helpers/parseHeaders');
|
||||
var transformData = require('./../helpers/transformData');
|
||||
var isURLSameOrigin = require('./../helpers/isURLSameOrigin');
|
||||
var btoa = window.btoa || require('./../helpers/btoa.js')
|
||||
|
||||
module.exports = function xhrAdapter(resolve, reject, config) {
|
||||
// Transform request data
|
||||
@@ -41,9 +42,9 @@ module.exports = function xhrAdapter(resolve, reject, config) {
|
||||
|
||||
// HTTP basic authentication
|
||||
if (config.auth) {
|
||||
requestHeaders['Authorization'] = 'Basic: ' + window.btoa(username + ':' + password);
|
||||
var username = config.auth.username || '';
|
||||
var password = config.auth.password || '';
|
||||
requestHeaders['Authorization'] = 'Basic: ' + btoa(username + ':' + password);
|
||||
}
|
||||
|
||||
// Create the request
|
||||
|
||||
Reference in New Issue
Block a user