remove custom isArrayBuffer (#822)
This commit is contained in:
parent
07c6b7490d
commit
a4293c22ae
|
@ -6,10 +6,11 @@
|
|||
*/
|
||||
|
||||
import Stream, {PassThrough} from 'stream';
|
||||
import {types} from 'util';
|
||||
|
||||
import Blob from 'fetch-blob';
|
||||
import FetchError from './errors/fetch-error.js';
|
||||
import {isBlob, isURLSearchParams, isArrayBuffer, isAbortError} from './utils/is.js';
|
||||
import {isBlob, isURLSearchParams, isAbortError} from './utils/is.js';
|
||||
|
||||
const INTERNALS = Symbol('Body internals');
|
||||
|
||||
|
@ -36,7 +37,7 @@ export default function Body(body, {
|
|||
// Body is blob
|
||||
} else if (Buffer.isBuffer(body)) {
|
||||
// Body is Buffer
|
||||
} else if (isArrayBuffer(body)) {
|
||||
} else if (types.isAnyArrayBuffer(body)) {
|
||||
// Body is ArrayBuffer
|
||||
body = Buffer.from(body);
|
||||
} else if (ArrayBuffer.isView(body)) {
|
||||
|
@ -315,7 +316,7 @@ export function extractContentType(body) {
|
|||
}
|
||||
|
||||
// Body is a Buffer (Buffer, ArrayBuffer or ArrayBufferView)
|
||||
if (Buffer.isBuffer(body) || isArrayBuffer(body) || ArrayBuffer.isView(body)) {
|
||||
if (Buffer.isBuffer(body) || types.isAnyArrayBuffer(body) || ArrayBuffer.isView(body)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -57,16 +57,6 @@ export function isAbortSignal(object) {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if `obj` is an instance of ArrayBuffer.
|
||||
*
|
||||
* @param {*} obj
|
||||
* @return {boolean}
|
||||
*/
|
||||
export function isArrayBuffer(object) {
|
||||
return object[NAME] === 'ArrayBuffer';
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if `obj` is an instance of AbortError.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue