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

doc: minor fixes to http/2 docs #14877

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
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
14 changes: 7 additions & 7 deletions doc/api/http2.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ added: v8.4.0
-->

The `'remoteSettings'` event is emitted when a new SETTINGS frame is received
from the connected peer. When invoked, the handle function will receive a copy
from the connected peer. When invoked, the handler function will receive a copy
of the remote settings.

```js
Expand Down Expand Up @@ -1725,7 +1725,7 @@ those to lower-case (e.g. `content-type`) upon transmission.

Header field-names *must only* contain one or more of the following ASCII
characters: `a`-`z`, `A`-`Z`, `0`-`9`, `!`, `#`, `$`, `%`, `&`, `'`, `*`, `+`,
`-`, `.`, `^`, `_`, `` (backtick), `|`, and `~`.
`-`, `.`, `^`, `_`, `` (backtick)`, `|`, and `~`.
Copy link
Member

Choose a reason for hiding this comment

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

I think this maybe would be better with (backtick) in plain (non-code) text? i.e. `^`, `_`, `` ` `` (backtick), `|`, …


Using invalid characters within an HTTP header field name will cause the
stream to be closed with a protocol error being reported.
Expand Down Expand Up @@ -1883,12 +1883,12 @@ const server = createSecureServer(

function onRequest(req, res) {
// detects if it is a HTTPS request or HTTP/2
const { socket: { alpnProtocol } } = request.httpVersion === '2.0' ?
request.stream.session : request;
response.writeHead(200, { 'content-type': 'application/json' });
response.end(JSON.stringify({
const { socket: { alpnProtocol } } = req.httpVersion === '2.0' ?
req.stream.session : req;
res.writeHead(200, { 'content-type': 'application/json' });
res.end(JSON.stringify({
alpnProtocol,
httpVersion: request.httpVersion
httpVersion: req.httpVersion
}));
}
```
Expand Down