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