From af85b6e058035e7432b34f07e2041c59a1db048a Mon Sep 17 00:00:00 2001 From: Keita Akutsu Date: Tue, 8 Aug 2017 01:15:44 +0900 Subject: [PATCH] doc: fix http2 sample code for http2.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/14667 Reviewed-By: Refael Ackermann Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: Evan Lucas Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig Reviewed-By: Tobias Nießen --- doc/api/http2.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/api/http2.md b/doc/api/http2.md index c1264c403d6729..cd034c5db882c0 100755 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -1242,7 +1242,7 @@ const { HTTP2_HEADER_CONTENT_TYPE } = http2.constants; -const server = http.createServer(); +const server = http2.createServer(); server.on('stream', (stream, headers, flags) => { const method = headers[HTTP2_HEADER_METHOD]; const path = headers[HTTP2_HEADER_PATH]; @@ -1328,7 +1328,7 @@ const { const options = getOptionsSomehow(); -const server = http.createSecureServer(options); +const server = http2.createSecureServer(options); server.on('stream', (stream, headers, flags) => { const method = headers[HTTP2_HEADER_METHOD]; const path = headers[HTTP2_HEADER_PATH]; @@ -2373,7 +2373,7 @@ to [`response.writeHead()`][] given precedence. ```js // returns content-type = text/plain -const server = http.createServer((req, res) => { +const server = http2.createServer((req, res) => { res.setHeader('Content-Type', 'text/html'); res.setHeader('X-Foo', 'bar'); res.writeHead(200, { 'Content-Type': 'text/plain' }); @@ -2416,8 +2416,8 @@ via `response.connection`. Example: ```js -const http = require('http'); -const server = http.createServer((req, res) => { +const http2 = require('http2'); +const server = http2.createServer((req, res) => { const ip = req.socket.remoteAddress; const port = req.socket.remotePort; res.end(`Your IP address is ${ip} and your source port is ${port}.`);