mirror of
https://github.com/tenrok/axios.git
synced 2026-06-20 20:00:40 +03:00
support node buffers less than 8192 bytes (#773)
This commit is contained in:
committed by
Rubén Norte
parent
bbfbeff4bc
commit
188334439f
@@ -30,13 +30,15 @@ module.exports = function httpAdapter(config) {
|
||||
}
|
||||
|
||||
if (data && !utils.isStream(data)) {
|
||||
if (utils.isArrayBuffer(data)) {
|
||||
if (utils.isBuffer(data)) {
|
||||
// Nothing to do...
|
||||
} else if (utils.isArrayBuffer(data)) {
|
||||
data = new Buffer(new Uint8Array(data));
|
||||
} else if (utils.isString(data)) {
|
||||
data = new Buffer(data, 'utf-8');
|
||||
} else {
|
||||
return reject(createError(
|
||||
'Data after transformation must be a string, an ArrayBuffer, or a Stream',
|
||||
'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream',
|
||||
config
|
||||
));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user