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: improve callback documentation of http2Stream.pushstream() #18258

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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