Skip to content

Commit dd930ca

Browse files
committed
Expose Http2ServerRequest/Response
In order for express (and possibly other libraries) to get and use the Http2ServerRequest/Response - expose them in the http2 exports. Same as is done in http module. This is only a suggestion - not sure if this is the way to go, but with this it allows for express to run with http2 server immediately. ref: expressjs/express#3390 fixes: nodejs#14672 Fix Lint
1 parent c3c045a commit dd930ca

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

lib/http2.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ const {
1313
getUnpackedSettings,
1414
createServer,
1515
createSecureServer,
16-
connect
16+
connect,
17+
Http2ServerRequest,
18+
Http2ServerResponse,
1719
} = require('internal/http2/core');
1820

1921
module.exports = {
@@ -23,5 +25,7 @@ module.exports = {
2325
getUnpackedSettings,
2426
createServer,
2527
createSecureServer,
26-
connect
28+
connect,
29+
Http2ServerResponse,
30+
Http2ServerRequest,
2731
};

lib/internal/http2/compat.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -573,4 +573,8 @@ function onServerStream(stream, headers, flags) {
573573
server.emit('request', request, response);
574574
}
575575

576-
module.exports = { onServerStream };
576+
module.exports = {
577+
onServerStream,
578+
Http2ServerRequest,
579+
Http2ServerResponse,
580+
};

lib/internal/http2/core.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ const fs = require('fs');
1515
const errors = require('internal/errors');
1616
const { Duplex } = require('stream');
1717
const { URL } = require('url');
18-
const { onServerStream } = require('internal/http2/compat');
18+
const { onServerStream,
19+
Http2ServerRequest,
20+
Http2ServerResponse,
21+
} = require('internal/http2/compat');
1922
const { utcDate } = require('internal/http');
2023
const { _connectionListener: httpConnectionListener } = require('http');
2124
const { isUint8Array } = process.binding('util');
@@ -2546,7 +2549,9 @@ module.exports = {
25462549
getUnpackedSettings,
25472550
createServer,
25482551
createSecureServer,
2549-
connect
2552+
connect,
2553+
Http2ServerRequest,
2554+
Http2ServerResponse
25502555
};
25512556

25522557
/* eslint-enable no-use-before-define */

0 commit comments

Comments
 (0)