From f27a25472cd9cb86252c36297f063e927ab6d0fc Mon Sep 17 00:00:00 2001 From: MaleDong Date: Fri, 17 Aug 2018 10:50:05 +0800 Subject: [PATCH] doc: make createPushResponse() more detailled We don't know what will return when successful or failure for the callback of the function. So this commit makes it more detailled. PR-URL: https://github.com/nodejs/node/pull/22366 Refs: https://github.com/nodejs/node/issues/22322 Reviewed-By: Matteo Collina Reviewed-By: James M Snell Reviewed-By: Trivikram Kamat --- doc/api/http2.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/doc/api/http2.md b/doc/api/http2.md index 3073928f6cded7..7ad1d0ae4fd21c 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -3150,13 +3150,17 @@ will result in a [`TypeError`][] being thrown. added: v8.4.0 --> * `headers` {HTTP/2 Headers Object} An object describing the headers -* `callback` {Function} - -Call [`http2stream.pushStream()`][] with the given headers, and wraps the -given newly created [`Http2Stream`] on `Http2ServerResponse`. +* `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 -The callback will be called with an error with code `ERR_HTTP2_INVALID_STREAM` -if the stream is closed. +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