-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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 API documentation issues #25952
Comments
@nodejs/http2 @nodejs/documentation |
Regarding the "compatibility example", I think it'd just need to be updated. it's just a bad example. I also think that we should document the "merge" behavior as described. It's quite important. The |
Wait, what now...? 😰 I followed his examples and used these constants (headers, status, etc) everywhere. What are the reasons against? |
Those are just normal http headers and strings. I think it's fairly instructive in not using them. |
There's nothing saying not to use them. I included them intentionally as a convenience. There's no problem in documenting them |
why wouldn't you want to use them? |
Why don't we have the same for |
@mcollina I mean, fwiw, I would totally use any constants with |
Maybe it’s just me then :/. |
Reasons for using the constants:
Still I'm fine if there is a desire to deprecate these constants. Plenty of userland alternatives on NPM. |
I also want to point out that in the 'Server Side example' snippet: // ...
server.on('stream', (stream, headers) => {
// stream is a Duplex
stream.respond({
'content-type': 'text/html',
':status': 200
});
stream.end('<h1>Hello World</h1>');
});
// ... Isn't |
It should not be needed, have you got a repro to show that it is needed? |
Oh, you're right! For server streams, The docs on stream lifecycle should be corrected to note this, then. I'll update #28044. |
Compatibility API example
Here's the example code from the API docs in the compatibility API section:
The
Content-Type
header is overwritten here inwriteHead()
, but unless the reader knows thatwriteHead()
merges its headers with the headers set insetHeader()
, the reader may think there's something special going on here.Suggestion: remove first call to
setHeader()
; ensure example is straightforwardNo documentation of
HTTP2_HEADER_*
constantsThere are many references to e.g.,
http2.constants.HTTP2_HEADER_STATUS
. These are not listed in the constants section. IsHTTP2_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.
The text was updated successfully, but these errors were encountered: