From 3062bcb13cf7fde1c688dff38546c9873f336ab7 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 24 Dec 2019 04:05:31 -0800 Subject: [PATCH] doc,http2: use code markup/markdown in headers PR-URL: https://github.com/nodejs/node/pull/31086 Reviewed-By: Anna Henningsen Reviewed-By: Ruben Bridgewater --- doc/api/http2.md | 302 +++++++++++++++++++++++------------------------ 1 file changed, 151 insertions(+), 151 deletions(-) diff --git a/doc/api/http2.md b/doc/api/http2.md index f4781fa9965d86..347170878df62d 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -95,7 +95,7 @@ req.on('end', () => { req.end(); ``` -### Class: Http2Session +### Class: `Http2Session` @@ -119,7 +119,7 @@ User code will not create `Http2Session` instances directly. Server-side new HTTP/2 connection is received. Client-side `Http2Session` instances are created using the `http2.connect()` method. -#### Http2Session and Sockets +#### `Http2Session` and Sockets Every `Http2Session` instance is associated with exactly one [`net.Socket`][] or [`tls.TLSSocket`][] when it is created. When either the `Socket` or the @@ -134,7 +134,7 @@ the socket to become unusable. Once a `Socket` has been bound to an `Http2Session`, user code should rely solely on the API of the `Http2Session`. -#### Event: 'close' +#### Event: `'close'` @@ -142,7 +142,7 @@ added: v8.4.0 The `'close'` event is emitted once the `Http2Session` has been destroyed. Its listener does not expect any arguments. -#### Event: 'connect' +#### Event: `'connect'` @@ -155,7 +155,7 @@ connected to the remote peer and communication may begin. User code will typically not listen for this event directly. -#### Event: 'error' +#### Event: `'error'` @@ -165,7 +165,7 @@ added: v8.4.0 The `'error'` event is emitted when an error occurs during the processing of an `Http2Session`. -#### Event: 'frameError' +#### Event: `'frameError'` @@ -185,7 +185,7 @@ closed and destroyed immediately following the `'frameError'` event. If the event is not associated with a stream, the `Http2Session` will be shut down immediately following the `'frameError'` event. -#### Event: 'goaway' +#### Event: `'goaway'` @@ -201,7 +201,7 @@ The `'goaway'` event is emitted when a `GOAWAY` frame is received. The `Http2Session` instance will be shut down automatically when the `'goaway'` event is emitted. -#### Event: 'localSettings' +#### Event: `'localSettings'` @@ -222,7 +222,7 @@ session.on('localSettings', (settings) => { }); ``` -#### Event: 'ping' +#### Event: `'ping'` @@ -232,7 +232,7 @@ added: v10.12.0 The `'ping'` event is emitted whenever a `PING` frame is received from the connected peer. -#### Event: 'remoteSettings' +#### Event: `'remoteSettings'` @@ -248,7 +248,7 @@ session.on('remoteSettings', (settings) => { }); ``` -#### Event: 'stream' +#### Event: `'stream'` @@ -303,7 +303,7 @@ Even though HTTP/2 streams and network sockets are not in a 1:1 correspondence, a network error will destroy each individual stream and must be handled on the stream level, as shown above. -#### Event: 'timeout' +#### Event: `'timeout'` @@ -318,7 +318,7 @@ session.setTimeout(2000); session.on('timeout', () => { /* .. */ }); ``` -#### http2session.alpnProtocol +#### `http2session.alpnProtocol` @@ -330,7 +330,7 @@ socket, `h2c` if the `Http2Session` is not connected to a `TLSSocket`, or will return the value of the connected `TLSSocket`'s own `alpnProtocol` property. -#### http2session.close(\[callback\]) +#### `http2session.close([callback])` @@ -345,7 +345,7 @@ are no open `Http2Stream` instances. If specified, the `callback` function is registered as a handler for the `'close'` event. -#### http2session.closed +#### `http2session.closed` @@ -355,7 +355,7 @@ added: v9.4.0 Will be `true` if this `Http2Session` instance has been closed, otherwise `false`. -#### http2session.connecting +#### `http2session.connecting` @@ -366,7 +366,7 @@ Will be `true` if this `Http2Session` instance is still connecting, will be set to `false` before emitting `connect` event and/or calling the `http2.connect` callback. -#### http2session.destroy(\[error\]\[, code\]) +#### `http2session.destroy([error][, code])` @@ -387,7 +387,7 @@ is not undefined, an `'error'` event will be emitted immediately before the If there are any remaining open `Http2Streams` associated with the `Http2Session`, those will also be destroyed. -#### http2session.destroyed +#### `http2session.destroyed` @@ -397,7 +397,7 @@ added: v8.4.0 Will be `true` if this `Http2Session` instance has been destroyed and must no longer be used, otherwise `false`. -#### http2session.encrypted +#### `http2session.encrypted` @@ -409,7 +409,7 @@ connected, `true` if the `Http2Session` is connected with a `TLSSocket`, and `false` if the `Http2Session` is connected to any other kind of socket or stream. -#### http2session.goaway(\[code\[, lastStreamID\[, opaqueData\]\]\]) +#### `http2session.goaway([code[, lastStreamID[, opaqueData]]])` @@ -422,7 +422,7 @@ added: v9.4.0 Transmits a `GOAWAY` frame to the connected peer *without* shutting down the `Http2Session`. -#### http2session.localSettings +#### `http2session.localSettings` @@ -432,7 +432,7 @@ added: v8.4.0 A prototype-less object describing the current local settings of this `Http2Session`. The local settings are local to *this* `Http2Session` instance. -#### http2session.originSet +#### `http2session.originSet` @@ -445,7 +445,7 @@ considered authoritative. The `originSet` property is only available when using a secure TLS connection. -#### http2session.pendingSettingsAck +#### `http2session.pendingSettingsAck` @@ -457,7 +457,7 @@ a sent `SETTINGS` frame. Will be `true` after calling the `http2session.settings()` method. Will be `false` once all sent `SETTINGS` frames have been acknowledged. -#### http2session.ping(\[payload, \]callback) +#### `http2session.ping([payload, ]callback)` @@ -495,7 +495,7 @@ session.ping(Buffer.from('abcdefgh'), (err, duration, payload) => { If the `payload` argument is not specified, the default payload will be the 64-bit timestamp (little endian) marking the start of the `PING` duration. -#### http2session.ref() +#### `http2session.ref()` @@ -503,7 +503,7 @@ added: v9.4.0 Calls [`ref()`][`net.Socket.prototype.ref()`] on this `Http2Session` instance's underlying [`net.Socket`][]. -#### http2session.remoteSettings +#### `http2session.remoteSettings` @@ -513,7 +513,7 @@ added: v8.4.0 A prototype-less object describing the current remote settings of this `Http2Session`. The remote settings are set by the *connected* HTTP/2 peer. -#### http2session.setTimeout(msecs, callback) +#### `http2session.setTimeout(msecs, callback)` @@ -525,7 +525,7 @@ Used to set a callback function that is called when there is no activity on the `Http2Session` after `msecs` milliseconds. The given `callback` is registered as a listener on the `'timeout'` event. -#### http2session.socket +#### `http2session.socket` @@ -543,7 +543,7 @@ an error with code `ERR_HTTP2_NO_SOCKET_MANIPULATION`. See All other interactions will be routed directly to the socket. -#### http2session.state +#### `http2session.state` @@ -573,7 +573,7 @@ Provides miscellaneous information about the current state of the An object describing the current status of this `Http2Session`. -#### http2session.settings(\[settings\]\[, callback\]) +#### `http2session.settings([settings][, callback])` @@ -596,7 +596,7 @@ The new settings will not become effective until the `SETTINGS` acknowledgment is received and the `'localSettings'` event is emitted. It is possible to send multiple `SETTINGS` frames while acknowledgment is still pending. -#### http2session.type +#### `http2session.type` @@ -608,7 +608,7 @@ The `http2session.type` will be equal to server, and `http2.constants.NGHTTP2_SESSION_CLIENT` if the instance is a client. -#### http2session.unref() +#### `http2session.unref()` @@ -616,14 +616,14 @@ added: v9.4.0 Calls [`unref()`][`net.Socket.prototype.unref()`] on this `Http2Session` instance's underlying [`net.Socket`][]. -### Class: ServerHttp2Session +### Class: `ServerHttp2Session` * Extends: {Http2Session} -#### serverhttp2session.altsvc(alt, originOrStream) +#### `serverhttp2session.altsvc(alt, originOrStream)` @@ -690,7 +690,7 @@ The protocol identifier (`'h2'` in the examples) may be any valid The syntax of these values is not validated by the Node.js implementation and are passed through as provided by the user or received from the peer. -#### serverhttp2session.origin(...origins) +#### `serverhttp2session.origin(...origins)` @@ -740,14 +740,14 @@ server.on('stream', (stream) => { }); ``` -### Class: ClientHttp2Session +### Class: `ClientHttp2Session` * Extends: {Http2Session} -#### Event: 'altsvc' +#### Event: `'altsvc'` @@ -772,7 +772,7 @@ client.on('altsvc', (alt, origin, streamId) => { }); ``` -#### Event: 'origin' +#### Event: `'origin'` @@ -796,7 +796,7 @@ client.on('origin', (origins) => { The `'origin'` event is only emitted when using a secure TLS connection. -#### clienthttp2session.request(headers\[, options\]) +#### `clienthttp2session.request(headers[, options])` @@ -859,7 +859,7 @@ they respectively default to: * `:method` = `'GET'` * `:path` = `/` -### Class: Http2Stream +### Class: `Http2Stream` @@ -887,7 +887,7 @@ All `Http2Stream` instances are [`Duplex`][] streams. The `Writable` side of the `Duplex` is used to send data to the connected peer, while the `Readable` side is used to receive data sent by the connected peer. -#### Http2Stream Lifecycle +#### `Http2Stream` Lifecycle ##### Creation @@ -931,7 +931,7 @@ property will be `true` and the `http2stream.rstCode` property will specify the `RST_STREAM` error code. The `Http2Stream` instance is no longer usable once destroyed. -#### Event: 'aborted' +#### Event: `'aborted'` @@ -943,7 +943,7 @@ Its listener does not expect any arguments. The `'aborted'` event will only be emitted if the `Http2Stream` writable side has not been ended. -#### Event: 'close' +#### Event: `'close'` @@ -955,7 +955,7 @@ The HTTP/2 error code used when closing the stream can be retrieved using the `http2stream.rstCode` property. If the code is any value other than `NGHTTP2_NO_ERROR` (`0`), an `'error'` event will have also been emitted. -#### Event: 'error' +#### Event: `'error'` @@ -965,7 +965,7 @@ added: v8.4.0 The `'error'` event is emitted when an error occurs during the processing of an `Http2Stream`. -#### Event: 'frameError' +#### Event: `'frameError'` @@ -981,7 +981,7 @@ argument identifying the frame type, and an integer argument identifying the error code. The `Http2Stream` instance will be destroyed immediately after the `'frameError'` event is emitted. -#### Event: 'timeout' +#### Event: `'timeout'` @@ -991,7 +991,7 @@ The `'timeout'` event is emitted after no activity is received for this `http2stream.setTimeout()`. Its listener does not expect any arguments. -#### Event: 'trailers' +#### Event: `'trailers'` @@ -1013,7 +1013,7 @@ stream.on('trailers', (headers, flags) => { }); ``` -#### Event: 'wantTrailers' +#### Event: `'wantTrailers'` @@ -1023,7 +1023,7 @@ final `DATA` frame to be sent on a frame and the `Http2Stream` is ready to send trailing headers. When initiating a request or response, the `waitForTrailers` option must be set for this event to be emitted. -#### http2stream.aborted +#### `http2stream.aborted` @@ -1033,7 +1033,7 @@ added: v8.4.0 Set to `true` if the `Http2Stream` instance was aborted abnormally. When set, the `'aborted'` event will have been emitted. -#### http2stream.bufferSize +#### `http2stream.bufferSize` @@ -1043,7 +1043,7 @@ added: v11.2.0 This property shows the number of characters currently buffered to be written. See [`net.Socket.bufferSize`][] for details. -#### http2stream.close(code\[, callback\]) +#### `http2stream.close(code[, callback])` @@ -1056,7 +1056,7 @@ added: v8.4.0 Closes the `Http2Stream` instance by sending an `RST_STREAM` frame to the connected HTTP/2 peer. -#### http2stream.closed +#### `http2stream.closed` @@ -1065,7 +1065,7 @@ added: v9.4.0 Set to `true` if the `Http2Stream` instance has been closed. -#### http2stream.destroyed +#### `http2stream.destroyed` @@ -1075,7 +1075,7 @@ added: v8.4.0 Set to `true` if the `Http2Stream` instance has been destroyed and is no longer usable. -#### http2stream.endAfterHeaders +#### `http2stream.endAfterHeaders` @@ -1086,7 +1086,7 @@ Set the `true` if the `END_STREAM` flag was set in the request or response HEADERS frame received, indicating that no additional data should be received and the readable side of the `Http2Stream` will be closed. -#### http2stream.id +#### `http2stream.id` @@ -1096,7 +1096,7 @@ added: v8.4.0 The numeric stream identifier of this `Http2Stream` instance. Set to `undefined` if the stream identifier has not yet been assigned. -#### http2stream.pending +#### `http2stream.pending` @@ -1106,7 +1106,7 @@ added: v9.4.0 Set to `true` if the `Http2Stream` instance has not yet been assigned a numeric stream identifier. -#### http2stream.priority(options) +#### `http2stream.priority(options)` @@ -1126,7 +1126,7 @@ added: v8.4.0 Updates the priority for this `Http2Stream` instance. -#### http2stream.rstCode +#### `http2stream.rstCode` @@ -1138,7 +1138,7 @@ destroyed after either receiving an `RST_STREAM` frame from the connected peer, calling `http2stream.close()`, or `http2stream.destroy()`. Will be `undefined` if the `Http2Stream` has not been closed. -#### http2stream.sentHeaders +#### `http2stream.sentHeaders` @@ -1147,7 +1147,7 @@ added: v9.5.0 An object containing the outbound headers sent for this `Http2Stream`. -#### http2stream.sentInfoHeaders +#### `http2stream.sentInfoHeaders` @@ -1157,7 +1157,7 @@ added: v9.5.0 An array of objects containing the outbound informational (additional) headers sent for this `Http2Stream`. -#### http2stream.sentTrailers +#### `http2stream.sentTrailers` @@ -1166,7 +1166,7 @@ added: v9.5.0 An object containing the outbound trailers sent for this `HttpStream`. -#### http2stream.session +#### `http2stream.session` @@ -1176,7 +1176,7 @@ added: v8.4.0 A reference to the `Http2Session` instance that owns this `Http2Stream`. The value will be `undefined` after the `Http2Stream` instance is destroyed. -#### http2stream.setTimeout(msecs, callback) +#### `http2stream.setTimeout(msecs, callback)` @@ -1194,7 +1194,7 @@ const req = client.request({ ':path': '/' }); req.setTimeout(5000, () => req.close(NGHTTP2_CANCEL)); ``` -#### http2stream.state +#### `http2stream.state` @@ -1216,7 +1216,7 @@ Provides miscellaneous information about the current state of the A current state of this `Http2Stream`. -#### http2stream.sendTrailers(headers) +#### `http2stream.sendTrailers(headers)` @@ -1245,7 +1245,7 @@ server.on('stream', (stream) => { The HTTP/1 specification forbids trailers from containing HTTP/2 pseudo-header fields (e.g. `':method'`, `':path'`, etc). -### Class: ClientHttp2Stream +### Class: `ClientHttp2Stream` @@ -1257,7 +1257,7 @@ used exclusively on HTTP/2 Clients. `Http2Stream` instances on the client provide events such as `'response'` and `'push'` that are only relevant on the client. -#### Event: 'continue' +#### Event: `'continue'` @@ -1266,7 +1266,7 @@ Emitted when the server sends a `100 Continue` status, usually because the request contained `Expect: 100-continue`. This is an instruction that the client should send the request body. -#### Event: 'headers' +#### Event: `'headers'` @@ -1282,7 +1282,7 @@ stream.on('headers', (headers, flags) => { }); ``` -#### Event: 'push' +#### Event: `'push'` @@ -1297,7 +1297,7 @@ stream.on('push', (headers, flags) => { }); ``` -#### Event: 'response' +#### Event: `'response'` @@ -1316,7 +1316,7 @@ req.on('response', (headers, flags) => { }); ``` -### Class: ServerHttp2Stream +### Class: `ServerHttp2Stream` @@ -1328,7 +1328,7 @@ used exclusively on HTTP/2 Servers. `Http2Stream` instances on the server provide additional methods such as `http2stream.pushStream()` and `http2stream.respond()` that are only relevant on the server. -#### http2stream.additionalHeaders(headers) +#### `http2stream.additionalHeaders(headers)` @@ -1337,7 +1337,7 @@ added: v8.4.0 Sends an additional informational `HEADERS` frame to the connected HTTP/2 peer. -#### http2stream.headersSent +#### `http2stream.headersSent` @@ -1346,7 +1346,7 @@ added: v8.4.0 True if headers were sent, false otherwise (read-only). -#### http2stream.pushAllowed +#### `http2stream.pushAllowed` @@ -1358,7 +1358,7 @@ client's most recent `SETTINGS` frame. Will be `true` if the remote peer accepts push streams, `false` otherwise. Settings are the same for every `Http2Stream` in the same `Http2Session`. -#### http2stream.pushStream(headers\[, options\], callback) +#### `http2stream.pushStream(headers[, options], callback)` @@ -1403,7 +1403,7 @@ a `weight` value to `http2stream.priority` with the `silent` option set to Calling `http2stream.pushStream()` from within a pushed stream is not permitted and will throw an error. -#### http2stream.respond(\[headers\[, options\]\]) +#### `http2stream.respond([headers[, options]])` @@ -1446,7 +1446,7 @@ server.on('stream', (stream) => { }); ``` -#### http2stream.respondWithFD(fd\[, headers\[, options\]\]) +#### `http2stream.respondWithFD(fd[, headers[, options]])` @@ -1669,7 +1669,7 @@ Instances of `Http2Server` are created using the `http2.createServer()` function. The `Http2Server` class is not exported directly by the `http2` module. -#### Event: 'checkContinue' +#### Event: `'checkContinue'` @@ -1691,7 +1691,7 @@ the request body. When this event is emitted and handled, the [`'request'`][] event will not be emitted. -#### Event: 'request' +#### Event: `'request'` @@ -1702,7 +1702,7 @@ added: v8.4.0 Emitted each time there is a request. There may be multiple requests per session. See the [Compatibility API][]. -#### Event: 'session' +#### Event: `'session'` @@ -1710,7 +1710,7 @@ added: v8.4.0 The `'session'` event is emitted when a new `Http2Session` is created by the `Http2Server`. -#### Event: 'sessionError' +#### Event: `'sessionError'` @@ -1718,7 +1718,7 @@ added: v8.4.0 The `'sessionError'` event is emitted when an `'error'` event is emitted by an `Http2Session` object associated with the `Http2Server`. -#### Event: 'stream' +#### Event: `'stream'` @@ -1749,7 +1749,7 @@ server.on('stream', (stream, headers, flags) => { }); ``` -#### Event: 'timeout' +#### Event: `'timeout'` @@ -1778,7 +1778,7 @@ If `callback` is provided, it is not invoked until all active sessions have been closed, although the server has already stopped allowing new sessions. See [`net.Server.close()`][] for more details. -#### server.setTimeout(\[msecs\]\[, callback\]) +#### `server.setTimeout([msecs][, callback])` @@ -1811,7 +1811,7 @@ Instances of `Http2SecureServer` are created using the `http2.createSecureServer()` function. The `Http2SecureServer` class is not exported directly by the `http2` module. -#### Event: 'checkContinue' +#### Event: `'checkContinue'` @@ -1833,7 +1833,7 @@ the request body. When this event is emitted and handled, the [`'request'`][] event will not be emitted. -#### Event: 'request' +#### Event: `'request'` @@ -1844,7 +1844,7 @@ added: v8.4.0 Emitted each time there is a request. There may be multiple requests per session. See the [Compatibility API][]. -#### Event: 'session' +#### Event: `'session'` @@ -1852,7 +1852,7 @@ added: v8.4.0 The `'session'` event is emitted when a new `Http2Session` is created by the `Http2SecureServer`. -#### Event: 'sessionError' +#### Event: `'sessionError'` @@ -1860,7 +1860,7 @@ added: v8.4.0 The `'sessionError'` event is emitted when an `'error'` event is emitted by an `Http2Session` object associated with the `Http2SecureServer`. -#### Event: 'stream' +#### Event: `'stream'` @@ -1893,7 +1893,7 @@ server.on('stream', (stream, headers, flags) => { }); ``` -#### Event: 'timeout' +#### Event: `'timeout'` @@ -1902,7 +1902,7 @@ The `'timeout'` event is emitted when there is no activity on the Server for a given number of milliseconds set using `http2secureServer.setTimeout()`. **Default:** 2 minutes. -#### Event: 'unknownProtocol' +#### Event: `'unknownProtocol'` @@ -1912,7 +1912,7 @@ negotiate an allowed protocol (i.e. HTTP/2 or HTTP/1.1). The event handler receives the socket for handling. If no listener is registered for this event, the connection is terminated. See the [Compatibility API][]. -#### server.close(\[callback\]) +#### `server.close([callback])` @@ -1928,7 +1928,7 @@ If `callback` is provided, it is not invoked until all active sessions have been closed, although the server has already stopped allowing new sessions. See [`tls.Server.close()`][] for more details. -#### server.setTimeout(\[msecs\]\[, callback\]) +#### `server.setTimeout([msecs][, callback])` @@ -1946,7 +1946,7 @@ The given callback is registered as a listener on the `'timeout'` event. In case of no callback function were assigned, a new `ERR_INVALID_CALLBACK` error will be thrown. -### http2.createServer(options\[, onRequestHandler\]) +### `http2.createServer(options[, onRequestHandler])` -#### Error Codes for RST_STREAM and GOAWAY +#### Error Codes for `RST_STREAM` and `GOAWAY` | Value | Name | Constant | @@ -2299,7 +2299,7 @@ added: v8.4.0 The `'timeout'` event is emitted when there is no activity on the Server for a given number of milliseconds set using `http2server.setTimeout()`. -### http2.getDefaultSettings() +### `http2.getDefaultSettings()` @@ -2310,7 +2310,7 @@ Returns an object containing the default settings for an `Http2Session` instance. This method returns a new object instance every time it is called so instances returned may be safely modified for use. -### http2.getPackedSettings(\[settings\]) +### `http2.getPackedSettings([settings])` @@ -2331,7 +2331,7 @@ console.log(packed.toString('base64')); // Prints: AAIAAAAA ``` -### http2.getUnpackedSettings(buf) +### `http2.getUnpackedSettings(buf)` @@ -2499,7 +2499,7 @@ client.on('stream', (pushedStream, requestHeaders) => { const req = client.request({ ':path': '/' }); ``` -### Supporting the CONNECT method +### Supporting the `CONNECT` method The `CONNECT` method is used to allow an HTTP/2 server to be used as a proxy for TCP/IP connections. @@ -2576,7 +2576,7 @@ req.on('end', () => { req.end('Jane'); ``` -### The Extended CONNECT Protocol +### The Extended `CONNECT` Protocol [RFC 8441][] defines an "Extended CONNECT Protocol" extension to HTTP/2 that may be used to bootstrap the use of an `Http2Stream` using the `CONNECT` @@ -2674,7 +2674,7 @@ function onRequest(req, res) { The `'request'` event works identically on both [HTTPS][] and HTTP/2. -### Class: http2.Http2ServerRequest +### Class: `http2.Http2ServerRequest` @@ -2686,7 +2686,7 @@ A `Http2ServerRequest` object is created by [`http2.Server`][] or [`'request'`][] event. It may be used to access a request status, headers, and data. -#### Event: 'aborted' +#### Event: `'aborted'` @@ -2697,7 +2697,7 @@ abnormally aborted in mid-communication. The `'aborted'` event will only be emitted if the `Http2ServerRequest` writable side has not been ended. -#### Event: 'close' +#### Event: `'close'` @@ -2705,7 +2705,7 @@ added: v8.4.0 Indicates that the underlying [`Http2Stream`][] was closed. Just like `'end'`, this event occurs only once per response. -#### request.aborted +#### `request.aborted` @@ -2715,7 +2715,7 @@ added: v10.1.0 The `request.aborted` property will be `true` if the request has been aborted. -#### request.authority +#### `request.authority` @@ -2725,7 +2725,7 @@ added: v8.4.0 The request authority pseudo header field. It can also be accessed via `req.headers[':authority']`. -#### request.complete +#### `request.complete` @@ -2735,7 +2735,7 @@ added: v12.10.0 The `request.complete` property will be `true` if the request has been completed, aborted, or destroyed. -#### request.connection +#### `request.connection` @@ -2760,7 +2760,7 @@ is emitted and `error` is passed as an argument to any listeners on the event. It does nothing if the stream was already destroyed. -#### request.headers +#### `request.headers` @@ -2793,7 +2793,7 @@ removeAllHeaders(request.headers); assert(request.url); // Fails because the :path header has been removed ``` -#### request.httpVersion +#### `request.httpVersion` @@ -2807,7 +2807,7 @@ client response, the HTTP version of the connected-to server. Returns Also `message.httpVersionMajor` is the first integer and `message.httpVersionMinor` is the second. -#### request.method +#### `request.method` @@ -2816,7 +2816,7 @@ added: v8.4.0 The request method as a string. Read-only. Examples: `'GET'`, `'DELETE'`. -#### request.rawHeaders +#### `request.rawHeaders` @@ -2845,7 +2845,7 @@ Header names are not lowercased, and duplicates are not merged. console.log(request.rawHeaders); ``` -#### request.rawTrailers +#### `request.rawTrailers` @@ -2855,7 +2855,7 @@ added: v8.4.0 The raw request/response trailer keys and values exactly as they were received. Only populated at the `'end'` event. -#### request.scheme +#### `request.scheme` @@ -2865,7 +2865,7 @@ added: v8.4.0 The request scheme pseudo header field indicating the scheme portion of the target URL. -#### request.setTimeout(msecs, callback) +#### `request.setTimeout(msecs, callback)` @@ -2883,7 +2883,7 @@ the server, then [`Http2Stream`][]s are destroyed when they time out. If a handler is assigned to the request, the response, or the server's `'timeout'` events, timed out sockets must be handled explicitly. -#### request.socket +#### `request.socket` @@ -2909,7 +2909,7 @@ All other interactions will be routed directly to the socket. With TLS support, use [`request.socket.getPeerCertificate()`][] to obtain the client's authentication details. -#### request.stream +#### `request.stream` @@ -2918,7 +2918,7 @@ added: v8.4.0 The [`Http2Stream`][] object backing the request. -#### request.trailers +#### `request.trailers` @@ -2927,7 +2927,7 @@ added: v8.4.0 The request/response trailers object. Only populated at the `'end'` event. -#### request.url +#### `request.url` @@ -2993,7 +2993,7 @@ Url { href: '/status?name=ryan' } ``` -### Class: http2.Http2ServerResponse +### Class: `http2.Http2ServerResponse` @@ -3003,7 +3003,7 @@ added: v8.4.0 This object is created internally by an HTTP server — not by the user. It is passed as the second parameter to the [`'request'`][] event. -#### Event: 'close' +#### Event: `'close'` @@ -3011,7 +3011,7 @@ added: v8.4.0 Indicates that the underlying [`Http2Stream`][] was terminated before [`response.end()`][] was called or able to flush. -#### Event: 'finish' +#### Event: `'finish'` @@ -3023,7 +3023,7 @@ does not imply that the client has received anything yet. After this event, no more events will be emitted on the response object. -#### response.addTrailers(headers) +#### `response.addTrailers(headers)` @@ -3036,7 +3036,7 @@ message) to the response. Attempting to set a header field name or value that contains invalid characters will result in a [`TypeError`][] being thrown. -#### response.connection +#### `response.connection` @@ -3100,7 +3100,7 @@ The name is case-insensitive. const contentType = response.getHeader('content-type'); ``` -#### response.getHeaderNames() +#### `response.getHeaderNames()` @@ -3118,7 +3118,7 @@ const headerNames = response.getHeaderNames(); // headerNames === ['foo', 'set-cookie'] ``` -#### response.getHeaders() +#### `response.getHeaders()` @@ -3144,7 +3144,7 @@ const headers = response.getHeaders(); // headers === { foo: 'bar', 'set-cookie': ['foo=bar', 'bar=baz'] } ``` -#### response.hasHeader(name) +#### `response.hasHeader(name)` @@ -3159,7 +3159,7 @@ outgoing headers. The header name matching is case-insensitive. const hasContentType = response.hasHeader('content-type'); ``` -#### response.headersSent +#### `response.headersSent` @@ -3168,7 +3168,7 @@ added: v8.4.0 True if headers were sent, false otherwise (read-only). -#### response.removeHeader(name) +#### `response.removeHeader(name)` @@ -3181,7 +3181,7 @@ Removes a header that has been queued for implicit sending. response.removeHeader('Content-Encoding'); ``` -#### response.sendDate +#### `response.sendDate` @@ -3194,7 +3194,7 @@ the response if it is not already present in the headers. Defaults to true. This should only be disabled for testing; HTTP requires the Date header in responses. -#### response.setHeader(name, value) +#### `response.setHeader(name, value)` @@ -3233,7 +3233,7 @@ const server = http2.createServer((req, res) => { }); ``` -#### response.setTimeout(msecs\[, callback\]) +#### `response.setTimeout(msecs\[, callback\])` @@ -3251,7 +3251,7 @@ the server, then [`Http2Stream`][]s are destroyed when they time out. If a handler is assigned to the request, the response, or the server's `'timeout'` events, timed out sockets must be handled explicitly. -#### response.socket +#### `response.socket` @@ -3284,7 +3284,7 @@ const server = http2.createServer((req, res) => { }).listen(3000); ``` -#### response.statusCode +#### `response.statusCode` @@ -3302,7 +3302,7 @@ response.statusCode = 404; After response header was sent to the client, this property indicates the status code which was sent out. -#### response.statusMessage +#### `response.statusMessage` @@ -3312,7 +3312,7 @@ added: v8.4.0 Status message is not supported by HTTP/2 (RFC 7540 8.1.2.4). It returns an empty string. -#### response.stream +#### `response.stream` @@ -3321,7 +3321,7 @@ added: v8.4.0 The [`Http2Stream`][] object backing the response. -#### response.writableEnded +#### `response.writableEnded` @@ -3332,7 +3332,7 @@ Is `true` after [`response.end()`][] has been called. This property does not indicate whether the data has been flushed, for this use [`writable.writableFinished`][] instead. -#### response.write(chunk\[, encoding\]\[, callback\]) +#### `response.write(chunk[, encoding][, callback])` @@ -3370,7 +3370,7 @@ Returns `true` if the entire data was flushed successfully to the kernel buffer. Returns `false` if all or part of the data was queued in user memory. `'drain'` will be emitted when the buffer is free again. -#### response.writeContinue() +#### `response.writeContinue()` @@ -3379,7 +3379,7 @@ Sends a status `100 Continue` to the client, indicating that the request body should be sent. See the [`'checkContinue'`][] event on `Http2Server` and `Http2SecureServer`. -#### response.writeHead(statusCode\[, statusMessage\]\[, headers\]) +#### `response.writeHead(statusCode[, statusMessage][, headers])`