mirror of
https://github.com/tenrok/axios.git
synced 2026-06-20 20:00:40 +03:00
committed by
Justin Beckwith
parent
d74238e151
commit
787c808c04
@@ -39,9 +39,9 @@ module.exports = function httpAdapter(config) {
|
||||
if (Buffer.isBuffer(data)) {
|
||||
// Nothing to do...
|
||||
} else if (utils.isArrayBuffer(data)) {
|
||||
data = new Buffer(new Uint8Array(data));
|
||||
data = Buffer.from(new Uint8Array(data));
|
||||
} else if (utils.isString(data)) {
|
||||
data = new Buffer(data, 'utf-8');
|
||||
data = Buffer.from(data, 'utf-8');
|
||||
} else {
|
||||
return reject(createError(
|
||||
'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream',
|
||||
@@ -124,7 +124,7 @@ module.exports = function httpAdapter(config) {
|
||||
|
||||
// Basic proxy authorization
|
||||
if (proxy.auth) {
|
||||
var base64 = new Buffer(proxy.auth.username + ':' + proxy.auth.password, 'utf8').toString('base64');
|
||||
var base64 = Buffer.from(proxy.auth.username + ':' + proxy.auth.password, 'utf8').toString('base64');
|
||||
options.headers['Proxy-Authorization'] = 'Basic ' + base64;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user