Skip to content

Commit

Permalink
doc: fix documentation of http2Stream.pushstream()
Browse files Browse the repository at this point in the history
Improve documentation of callback signature of
http2Stream.pushStream() function to align with
the changes made in #17406.

PR-URL: #18258
Fixes: #18198
Refs: #17406
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
nephross authored and evanlucas committed Jan 30, 2018
1 parent 4d3121b commit 574d3b9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion doc/api/http2.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -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');
Expand Down

0 comments on commit 574d3b9

Please sign in to comment.