From 96d95d4fed691a51a3b156e5e631e9c2f9ded7f0 Mon Sep 17 00:00:00 2001 From: Anand Suresh Date: Wed, 16 Aug 2017 15:02:10 -0700 Subject: [PATCH] doc: minor fixes to http/2 docs PR-URL: https://github.com/nodejs/node/pull/14877 Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca --- doc/api/http2.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/api/http2.md b/doc/api/http2.md index eaf88483cd0bd4..13a5750158fa2f 100755 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -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 @@ -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 `~`. Using invalid characters within an HTTP header field name will cause the stream to be closed with a protocol error being reported. @@ -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 })); } ```