-
-
Notifications
You must be signed in to change notification settings - Fork 37.1k
Http2SecureServer Is Not Exported #21434
Copy link
Copy link
Closed
Labels
feature requestIssues requesting new Node.js features.Issues requesting new Node.js features.http2Issues and PRs related to the http2 subsystem.Issues and PRs related to the http2 subsystem.
Description
Activity
Metadata
Metadata
Assignees
Labels
feature requestIssues requesting new Node.js features.Issues requesting new Node.js features.http2Issues and PRs related to the http2 subsystem.Issues and PRs related to the http2 subsystem.
While writing tests for a project I found myself wanting to assert that the return value from a function was an instance of
Http2SecureServer. However, upon trying to find the export forHttp2SecureServer, I wound up at https://github.com/nodejs/node/blob/master/lib/internal/http2/core.js and found that the class isn't actually listed in the exports. So there's no discernible way to run aninstanceofagainst my return variable, as I can't reference the class.It's an unfortunate limitation; while testing that an object is an instance of
tls.Serveris fine and good, I would much rather add an extra layer of assertiveness and make sure that my return value was in fact an instance ofHttp2SecureServer, as the mechanisms in my use case can also returnhttps.Server, which also inherits fromtls.Server.On the surface this seems like a glaring omission. But there's probably a reason for that. What's the scoop?
Update: It would seem the same is true for
Http2Serveras well.