-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1197,8 +1197,11 @@ added: v8.4.0 | |
**Default:** `false` | ||
* `parent` {number} Specifies the numeric identifier of a stream the newly | ||
created stream is dependent on. | ||
* `callback` {Function} Callback that is called once the push stream has been | ||
initiated. | ||
* `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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A nit: this line also needs wrapping (currently 84 characters). Sorry for the pettiness) This can be fixed by a commit lander if it is not convenient for you to amend the commit or push more commits) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's all good. My first pr, so I'm here to learn. |
||
* Returns: {undefined} | ||
|
||
Initiates a push stream. The callback is invoked with the new `Http2Stream` | ||
|
@@ -1210,7 +1213,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'); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A nit: I wonder if the hard line break is rendered here due to missing indentation.