-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Open
Labels
docIssues and PRs related to the documentations.Issues and PRs related to the documentations.help wantedIssues that need assistance from volunteers or PRs that need help to proceed.Issues that need assistance from volunteers or PRs that need help to proceed.http2Issues or PRs related to the http2 subsystem.Issues or PRs related to the http2 subsystem.
Description
Compatibility API example
Here's the example code from the API docs in the compatibility API section:
const http2 = require('http2');
const server = http2.createServer((req, res) => {
res.setHeader('Content-Type', 'text/html');
res.setHeader('X-Foo', 'bar');
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('ok');
});The Content-Type header is overwritten here in writeHead(), but unless the reader knows that writeHead() merges its headers with the headers set in setHeader(), the reader may think there's something special going on here.
Suggestion: remove first call to setHeader(); ensure example is straightforward
No documentation of HTTP2_HEADER_* constants
There are many references to e.g., http2.constants.HTTP2_HEADER_STATUS. These are not listed in the constants section. Is HTTP2_HEADER_CONTENT_TYPE different than 'Content-Type'? Can these be used interchangeably? If I use the compatibility API, should I use these constants?
Suggestion: document the constants and when to use them.
Metadata
Metadata
Assignees
Labels
docIssues and PRs related to the documentations.Issues and PRs related to the documentations.help wantedIssues that need assistance from volunteers or PRs that need help to proceed.Issues that need assistance from volunteers or PRs that need help to proceed.http2Issues or PRs related to the http2 subsystem.Issues or PRs related to the http2 subsystem.