diff --git a/lib/dispatcher/client-h1.js b/lib/dispatcher/client-h1.js index c537ed838ec..2f1c96724d3 100644 --- a/lib/dispatcher/client-h1.js +++ b/lib/dispatcher/client-h1.js @@ -978,19 +978,19 @@ function writeH1 (client, request) { /* istanbul ignore else: assertion */ if (!body || bodyLength === 0) { - writeBuffer({ abort, body: null, client, request, socket, contentLength, header, expectsPayload }) + writeBuffer(abort, null, client, request, socket, contentLength, header, expectsPayload) } else if (util.isBuffer(body)) { - writeBuffer({ abort, body, client, request, socket, contentLength, header, expectsPayload }) + writeBuffer(abort, body, client, request, socket, contentLength, header, expectsPayload) } else if (util.isBlobLike(body)) { if (typeof body.stream === 'function') { - writeIterable({ abort, body: body.stream(), client, request, socket, contentLength, header, expectsPayload }) + writeIterable(abort, body.stream(), client, request, socket, contentLength, header, expectsPayload) } else { - writeBlob({ abort, body, client, request, socket, contentLength, header, expectsPayload }) + writeBlob(abort, body, client, request, socket, contentLength, header, expectsPayload) } } else if (util.isStream(body)) { - writeStream({ abort, body, client, request, socket, contentLength, header, expectsPayload }) + writeStream(abort, body, client, request, socket, contentLength, header, expectsPayload) } else if (util.isIterable(body)) { - writeIterable({ abort, body, client, request, socket, contentLength, header, expectsPayload }) + writeIterable(abort, body, client, request, socket, contentLength, header, expectsPayload) } else { assert(false) } @@ -998,7 +998,7 @@ function writeH1 (client, request) { return true } -function writeStream ({ abort, body, client, request, socket, contentLength, header, expectsPayload }) { +function writeStream (abort, body, client, request, socket, contentLength, header, expectsPayload) { assert(contentLength !== 0 || client[kRunning] === 0, 'stream body cannot be pipelined') let finished = false @@ -1101,7 +1101,7 @@ function writeStream ({ abort, body, client, request, socket, contentLength, hea } } -function writeBuffer ({ abort, body, client, request, socket, contentLength, header, expectsPayload }) { +function writeBuffer (abort, body, client, request, socket, contentLength, header, expectsPayload) { try { if (!body) { if (contentLength === 0) { @@ -1131,7 +1131,7 @@ function writeBuffer ({ abort, body, client, request, socket, contentLength, hea } } -async function writeBlob ({ abort, body, client, request, socket, contentLength, header, expectsPayload }) { +async function writeBlob (abort, body, client, request, socket, contentLength, header, expectsPayload) { assert(contentLength === body.size, 'blob body must have content length') try { @@ -1159,7 +1159,7 @@ async function writeBlob ({ abort, body, client, request, socket, contentLength, } } -async function writeIterable ({ abort, body, client, request, socket, contentLength, header, expectsPayload }) { +async function writeIterable (abort, body, client, request, socket, contentLength, header, expectsPayload) { assert(contentLength !== 0 || client[kRunning] === 0, 'iterator body cannot be pipelined') let callback = null diff --git a/lib/dispatcher/client-h2.js b/lib/dispatcher/client-h2.js index c78fe602c48..6c5155717d1 100644 --- a/lib/dispatcher/client-h2.js +++ b/lib/dispatcher/client-h2.js @@ -477,82 +477,80 @@ function writeH2 (client, request) { function writeBodyH2 () { /* istanbul ignore else: assertion */ if (!body || contentLength === 0) { - writeBuffer({ + writeBuffer( abort, + stream, + null, client, request, + client[kSocket], contentLength, - expectsPayload, - h2stream: stream, - body: null, - socket: client[kSocket] - }) + expectsPayload + ) } else if (util.isBuffer(body)) { - writeBuffer({ + writeBuffer( abort, + stream, + body, client, request, + client[kSocket], contentLength, - body, - expectsPayload, - h2stream: stream, - socket: client[kSocket] - }) + expectsPayload + ) } else if (util.isBlobLike(body)) { if (typeof body.stream === 'function') { - writeIterable({ + writeIterable( abort, + stream, + body.stream(), client, request, + client[kSocket], contentLength, - expectsPayload, - h2stream: stream, - body: body.stream(), - socket: client[kSocket] - }) + expectsPayload + ) } else { - writeBlob({ + writeBlob( abort, + stream, body, client, request, + client[kSocket], contentLength, - expectsPayload, - h2stream: stream, - socket: client[kSocket] - }) + expectsPayload + ) } } else if (util.isStream(body)) { - writeStream({ + writeStream( abort, + client[kSocket], + expectsPayload, + stream, body, client, request, - contentLength, - expectsPayload, - socket: client[kSocket], - h2stream: stream, - header: '' - }) + contentLength + ) } else if (util.isIterable(body)) { - writeIterable({ + writeIterable( abort, + stream, body, client, request, + client[kSocket], contentLength, - expectsPayload, - header: '', - h2stream: stream, - socket: client[kSocket] - }) + expectsPayload + ) } else { assert(false) } } } -function writeBuffer ({ abort, h2stream, body, client, request, socket, contentLength, expectsPayload }) { +function writeBuffer (abort, h2stream, body, client, request, socket, contentLength, expectsPayload) { try { if (body != null && util.isBuffer(body)) { assert(contentLength === body.byteLength, 'buffer body must have content length') @@ -575,7 +573,7 @@ function writeBuffer ({ abort, h2stream, body, client, request, socket, contentL } } -function writeStream ({ abort, socket, expectsPayload, h2stream, body, client, request, contentLength }) { +function writeStream (abort, socket, expectsPayload, h2stream, body, client, request, contentLength) { assert(contentLength !== 0 || client[kRunning] === 0, 'stream body cannot be pipelined') // For HTTP/2, is enough to pipe the stream @@ -606,7 +604,7 @@ function writeStream ({ abort, socket, expectsPayload, h2stream, body, client, r } } -async function writeBlob ({ abort, h2stream, body, client, request, socket, contentLength, expectsPayload }) { +async function writeBlob (abort, h2stream, body, client, request, socket, contentLength, expectsPayload) { assert(contentLength === body.size, 'blob body must have content length') try { @@ -634,7 +632,7 @@ async function writeBlob ({ abort, h2stream, body, client, request, socket, cont } } -async function writeIterable ({ abort, h2stream, body, client, request, socket, contentLength, expectsPayload }) { +async function writeIterable (abort, h2stream, body, client, request, socket, contentLength, expectsPayload) { assert(contentLength !== 0 || client[kRunning] === 0, 'iterator body cannot be pipelined') let callback = null