Skip to content

Commit

Permalink
Expose Http2ServerRequest/Response
Browse files Browse the repository at this point in the history
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
  • Loading branch information
phouri committed Aug 10, 2017
1 parent c3c045a commit dd930ca
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
8 changes: 6 additions & 2 deletions lib/http2.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ const {
getUnpackedSettings,
createServer,
createSecureServer,
connect
connect,
Http2ServerRequest,
Http2ServerResponse,
} = require('internal/http2/core');

module.exports = {
Expand All @@ -23,5 +25,7 @@ module.exports = {
getUnpackedSettings,
createServer,
createSecureServer,
connect
connect,
Http2ServerResponse,
Http2ServerRequest,
};
6 changes: 5 additions & 1 deletion lib/internal/http2/compat.js
Original file line number Diff line number Diff line change
Expand Up @@ -573,4 +573,8 @@ function onServerStream(stream, headers, flags) {
server.emit('request', request, response);
}

module.exports = { onServerStream };
module.exports = {
onServerStream,
Http2ServerRequest,
Http2ServerResponse,
};
9 changes: 7 additions & 2 deletions lib/internal/http2/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ const fs = require('fs');
const errors = require('internal/errors');
const { Duplex } = require('stream');
const { URL } = require('url');
const { onServerStream } = require('internal/http2/compat');
const { onServerStream,
Http2ServerRequest,
Http2ServerResponse,
} = require('internal/http2/compat');
const { utcDate } = require('internal/http');
const { _connectionListener: httpConnectionListener } = require('http');
const { isUint8Array } = process.binding('util');
Expand Down Expand Up @@ -2546,7 +2549,9 @@ module.exports = {
getUnpackedSettings,
createServer,
createSecureServer,
connect
connect,
Http2ServerRequest,
Http2ServerResponse
};

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

0 comments on commit dd930ca

Please sign in to comment.