Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http2: add constant to already destructured constants #28176

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/internal/http2/compat.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ const { Object, ObjectPrototype, Reflect } = primordials;

const assert = require('internal/assert');
const Stream = require('stream');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const Stream = require('stream');

const Readable = Stream.Readable;
const binding = internalBinding('http2');
const constants = binding.constants;
const { Readable } = Stream;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const { Readable } = Stream;
const { Readable } = require('stream');

Copy link
Contributor Author

@dnalborczyk dnalborczyk Jun 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thing is that Http2ServerResponse extends from Stream below, so we need a Stream reference as well. if we could use ES6 modules internally, I'd use a 'default', and a 'named import': import Stream, { Readable } from ....

const { constants } = internalBinding('http2');
BridgeAR marked this conversation as resolved.
Show resolved Hide resolved
const {
codes: {
ERR_HTTP2_HEADERS_SENT,
Expand Down Expand Up @@ -38,6 +37,7 @@ const kAborted = Symbol('aborted');

const {
HTTP2_HEADER_AUTHORITY,
HTTP2_HEADER_CONNECTION,
HTTP2_HEADER_METHOD,
HTTP2_HEADER_PATH,
HTTP2_HEADER_SCHEME,
Expand Down Expand Up @@ -95,7 +95,7 @@ function statusMessageWarn() {
}

function isConnectionHeaderAllowed(name, value) {
return name !== constants.HTTP2_HEADER_CONNECTION ||
return name !== HTTP2_HEADER_CONNECTION ||
value === 'trailers';
}

Expand Down