Skip to content

Http2SecureServer Is Not Exported #21434

Description

@shellscape
  • Version: 10.5.0
  • Platform: MacOS 10.13.2
  • Subsystem: None

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 for Http2SecureServer, 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 an instanceof against 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.Server is 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 of Http2SecureServer, as the mechanisms in my use case can also return https.Server, which also inherits from tls.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 Http2Server as well.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues requesting new Node.js features.http2Issues and PRs related to the http2 subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions