diff --git a/ext/fetch/22_body.js b/ext/fetch/22_body.js index c9702488c7..fcbce43e37 100644 --- a/ext/fetch/22_body.js +++ b/ext/fetch/22_body.js @@ -331,6 +331,10 @@ if (object.type.length !== 0) { contentType = object.type; } + } else if (object instanceof Uint8Array) { + // Fast(er) path for common case of Uint8Array + const copy = TypedArrayPrototypeSlice(object, 0, object.byteLength); + source = copy; } else if (ArrayBufferIsView(object) || object instanceof ArrayBuffer) { const u8 = ArrayBufferIsView(object) ? new Uint8Array(