(abort, body, client, request, socket, contentLength, header, expectsPayload)
| 6856 | } |
| 6857 | } |
| 6858 | function writeBlob(abort, body, client, request, socket, contentLength, header, expectsPayload) { |
| 6859 | return __async(this, null, function* () { |
| 6860 | assert(contentLength === body.size, "blob body must have content length"); |
| 6861 | try { |
| 6862 | if (contentLength != null && contentLength !== body.size) { |
| 6863 | throw new RequestContentLengthMismatchError(); |
| 6864 | } |
| 6865 | const buffer = Buffer.from(yield body.arrayBuffer()); |
| 6866 | socket.cork(); |
| 6867 | socket.write(`${header}content-length: ${contentLength}\r |
| 6868 | \r |
| 6869 | `, "latin1"); |
| 6870 | socket.write(buffer); |
| 6871 | socket.uncork(); |
| 6872 | request.onBodySent(buffer); |
| 6873 | request.onRequestSent(); |
| 6874 | if (!expectsPayload && request.reset !== false) { |
| 6875 | socket[kReset] = true; |
| 6876 | } |
| 6877 | client[kResume](); |
| 6878 | } catch (err) { |
| 6879 | abort(err); |
| 6880 | } |
| 6881 | }); |
| 6882 | } |
| 6883 | function writeIterable(abort, body, client, request, socket, contentLength, header, expectsPayload) { |
| 6884 | return __async(this, null, function* () { |
| 6885 | assert(contentLength !== 0 || client[kRunning] === 0, "iterator body cannot be pipelined"); |
no test coverage detected