diff --git a/dist/cleanup/index.js b/dist/cleanup/index.js index 16c4d9b..9f08ac2 100644 --- a/dist/cleanup/index.js +++ b/dist/cleanup/index.js @@ -12332,11 +12332,22 @@ __name(writeRequestBody, "writeRequestBody"); function writeBody(httpRequest, body) { if (body instanceof import_stream.Readable) { body.pipe(httpRequest); - } else if (body) { - httpRequest.end(Buffer.from(body)); - } else { - httpRequest.end(); + return; } + if (body) { + if (Buffer.isBuffer(body) || typeof body === "string") { + httpRequest.end(body); + return; + } + const uint8 = body; + if (typeof uint8 === "object" && uint8.buffer && typeof uint8.byteOffset === "number" && typeof uint8.byteLength === "number") { + httpRequest.end(Buffer.from(uint8.buffer, uint8.byteOffset, uint8.byteLength)); + return; + } + httpRequest.end(Buffer.from(body)); + return; + } + httpRequest.end(); } __name(writeBody, "writeBody"); diff --git a/dist/index.js b/dist/index.js index 6ad08a7..f13da2d 100644 --- a/dist/index.js +++ b/dist/index.js @@ -12920,11 +12920,22 @@ __name(writeRequestBody, "writeRequestBody"); function writeBody(httpRequest, body) { if (body instanceof import_stream.Readable) { body.pipe(httpRequest); - } else if (body) { - httpRequest.end(Buffer.from(body)); - } else { - httpRequest.end(); + return; } + if (body) { + if (Buffer.isBuffer(body) || typeof body === "string") { + httpRequest.end(body); + return; + } + const uint8 = body; + if (typeof uint8 === "object" && uint8.buffer && typeof uint8.byteOffset === "number" && typeof uint8.byteLength === "number") { + httpRequest.end(Buffer.from(uint8.buffer, uint8.byteOffset, uint8.byteLength)); + return; + } + httpRequest.end(Buffer.from(body)); + return; + } + httpRequest.end(); } __name(writeBody, "writeBody");