doc: fix documentation of http2Stream.pushstream()
Improve documentation of callback signature of http2Stream.pushStream() function to align with the changes made in https://github.com/nodejs/node/pull/17406. PR-URL: https://github.com/nodejs/node/pull/18258 Fixes: https://github.com/nodejs/node/issues/18198 Refs: https://github.com/nodejs/node/pull/17406 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
553d4ee57d
commit
b886c424fb
@ -1199,6 +1199,10 @@ added: v8.4.0
|
||||
created stream is dependent on.
|
||||
* `callback` {Function} Callback that is called once the push stream has been
|
||||
initiated.
|
||||
* `err` {Error}
|
||||
* `pushStream` {[`ServerHttp2Stream`][]} The returned pushStream object.
|
||||
* `headers` {[Headers Object][]} Headers object the pushStream was initiated
|
||||
with.
|
||||
* Returns: {undefined}
|
||||
|
||||
Initiates a push stream. The callback is invoked with the new `Http2Stream`
|
||||
@ -1210,7 +1214,7 @@ const http2 = require('http2');
|
||||
const server = http2.createServer();
|
||||
server.on('stream', (stream) => {
|
||||
stream.respond({ ':status': 200 });
|
||||
stream.pushStream({ ':path': '/' }, (err, pushStream) => {
|
||||
stream.pushStream({ ':path': '/' }, (err, pushStream, headers) => {
|
||||
if (err) throw err;
|
||||
pushStream.respond({ ':status': 200 });
|
||||
pushStream.end('some pushed data');
|
||||
|
Loading…
x
Reference in New Issue
Block a user