summaryrefslogtreecommitdiff
path: root/ext/fetch/22_body.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/fetch/22_body.js')
-rw-r--r--ext/fetch/22_body.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/ext/fetch/22_body.js b/ext/fetch/22_body.js
index c9702488c..fcbce43e3 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(