(client, request3)
| 54811 | } else { |
| 54812 | client[kQueue].splice(client[kPendingIdx], 1); |
| 54813 | } |
| 54814 | } |
| 54815 | } |
| 54816 | function shouldSendContentLength(method) { |
| 54817 | return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT"; |
| 54818 | } |
| 54819 | function write(client, request3) { |
| 54820 | if (client[kHTTPConnVersion] === "h2") { |
| 54821 | writeH2(client, client[kHTTP2Session], request3); |
| 54822 | return; |
| 54823 | } |
| 54824 | const { body, method, path: path5, host, upgrade, headers, blocking, reset } = request3; |
| 54825 | const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH"; |
| 54826 | if (body && typeof body.read === "function") { |
| 54827 | body.read(0); |
| 54828 | } |
| 54829 | const bodyLength = util4.bodyLength(body); |
| 54830 | let contentLength = bodyLength; |
| 54831 | if (contentLength === null) { |
| 54832 | contentLength = request3.contentLength; |
| 54833 | } |
| 54834 | if (contentLength === 0 && !expectsPayload) { |
| 54835 | contentLength = null; |
| 54836 | } |
| 54837 | if (shouldSendContentLength(method) && contentLength > 0 && request3.contentLength !== null && request3.contentLength !== contentLength) { |
| 54838 | if (client[kStrictContentLength]) { |
| 54839 | errorRequest(client, request3, new RequestContentLengthMismatchError()); |
| 54840 | return false; |
| 54841 | } |
| 54842 | process.emitWarning(new RequestContentLengthMismatchError()); |
| 54843 | } |
| 54844 | const socket = client[kSocket]; |
| 54845 | try { |
| 54846 | request3.onConnect((err) => { |
| 54847 | if (request3.aborted || request3.completed) { |
| 54848 | return; |
| 54849 | } |
| 54850 | errorRequest(client, request3, err || new RequestAbortedError()); |
| 54851 | util4.destroy(socket, new InformationalError("aborted")); |
| 54852 | }); |
| 54853 | } catch (err) { |
| 54854 | errorRequest(client, request3, err); |
| 54855 | } |
| 54856 | if (request3.aborted) { |
| 54857 | return false; |
| 54858 | } |
| 54859 | if (method === "HEAD") { |
| 54860 | socket[kReset] = true; |
| 54861 | } |
| 54862 | if (upgrade || method === "CONNECT") { |
| 54863 | socket[kReset] = true; |
| 54864 | } |
| 54865 | if (reset != null) { |
| 54866 | socket[kReset] = reset; |
| 54867 | } |
| 54868 | if (client[kMaxRequests] && socket[kCounter]++ >= client[kMaxRequests]) { |
| 54869 | socket[kReset] = true; |
| 54870 | } |
no test coverage detected
searching dependent graphs…