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: correct callback parameter type for createPushResponse() #36631

Merged
merged 2 commits into from Dec 27, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 19 additions & 18 deletions doc/api/http2.md
Expand Up @@ -3283,6 +3283,25 @@ deprecated: v13.0.0

See [`response.socket`][].

#### `response.createPushResponse(headers, callback)`
<!-- YAML
added: v8.4.0
-->

* `headers` {HTTP/2 Headers Object} An object describing the headers
* `callback` {Function} Called once `http2stream.pushStream()` is finished,
or either when the attempt to create the pushed `Http2Stream` has failed or
has been rejected, or the state of `Http2ServerRequest` is closed prior to
calling the `http2stream.pushStream()` method
* `err` {Error}
* `res` {http2.Http2ServerResponse} The newly-created `Http2ServerResponse`
object

Call [`http2stream.pushStream()`][] with the given headers, and wrap the
given [`Http2Stream`][] on a newly created `Http2ServerResponse` as the callback
parameter if successful. When `Http2ServerRequest` is closed, the callback is
called with an error `ERR_HTTP2_INVALID_STREAM`.

#### `response.end([data[, encoding]][, callback])`
<!-- YAML
added: v8.4.0
Expand Down Expand Up @@ -3680,24 +3699,6 @@ const server = http2.createServer((req, res) => {
Attempting to set a header field name or value that contains invalid characters
will result in a [`TypeError`][] being thrown.

#### `response.createPushResponse(headers, callback)`
<!-- YAML
added: v8.4.0
-->

* `headers` {HTTP/2 Headers Object} An object describing the headers
* `callback` {Function} Called once `http2stream.pushStream()` is finished,
or either when the attempt to create the pushed `Http2Stream` has failed or
has been rejected, or the state of `Http2ServerRequest` is closed prior to
calling the `http2stream.pushStream()` method
* `err` {Error}
* `stream` {ServerHttp2Stream} The newly-created `ServerHttp2Stream` object

Call [`http2stream.pushStream()`][] with the given headers, and wrap the
given [`Http2Stream`][] on a newly created `Http2ServerResponse` as the callback
parameter if successful. When `Http2ServerRequest` is closed, the callback is
called with an error `ERR_HTTP2_INVALID_STREAM`.

## Collecting HTTP/2 performance metrics

The [Performance Observer][] API can be used to collect basic performance
Expand Down