diff --git a/lib/core/request.js b/lib/core/request.js index 377bf31984b..c44cd0891f5 100644 --- a/lib/core/request.js +++ b/lib/core/request.js @@ -10,6 +10,7 @@ const { isValidHeaderValue, isStream, destroy, + isBuffer, isFormDataLike, isIterable, isBlobLike, @@ -111,7 +112,7 @@ class Request { } } this.body.on('error', this.errorHandler) - } else if (Buffer.isBuffer(body)) { + } else if (isBuffer(body)) { this.body = body.byteLength ? body : null } else if (ArrayBuffer.isView(body)) { this.body = body.buffer.byteLength ? Buffer.from(body.buffer, body.byteOffset, body.byteLength) : null