Skip to content

Commit b23d1f7

Browse files
committed
refactor: separate writeH1 and writeH2
1 parent 3379548 commit b23d1f7

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lib/dispatcher/client.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,10 +1399,15 @@ function shouldSendContentLength (method) {
13991399

14001400
function write (client, request) {
14011401
if (client[kHTTPConnVersion] === 'h2') {
1402-
writeH2(client, client[kHTTP2Session], request)
1403-
return
1402+
// TODO (fix): Why does this not return the value
1403+
// from writeH2.
1404+
writeH2(client, request)
1405+
} else {
1406+
return writeH1(client, request)
14041407
}
1408+
}
14051409

1410+
function writeH1 (client, request) {
14061411
const { method, path, host, upgrade, blocking, reset } = request
14071412

14081413
let { body, headers, contentLength } = request
@@ -1580,7 +1585,8 @@ function write (client, request) {
15801585
return true
15811586
}
15821587

1583-
function writeH2 (client, session, request) {
1588+
function writeH2 (client, request) {
1589+
const session = client[kHTTP2Session]
15841590
const { body, method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request
15851591

15861592
let headers

0 commit comments

Comments
 (0)