Skip to content

Commit

Permalink
doc: improve the doc of the 'information' event
Browse files Browse the repository at this point in the history
- Add missing argument
- Reword a sentence
- Rename the `res` argument to `info` in the example to avoid confusion

PR-URL: #27009
Fixes: #26905
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Signed-off-by: Beth Griggs <Bethany.Griggs@uk.ibm.com>
  • Loading branch information
lpinca authored and BethGriggs committed Apr 9, 2019
1 parent f65cb75 commit 7b37c65
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions doc/api/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,11 @@ the client should send the request body.
added: v10.0.0
-->

Emitted when the server sends a 1xx response (excluding 101 Upgrade). This
event is emitted with a callback containing an object with a status code.
* `info` {Object}
* `statusCode` {integer}

Emitted when the server sends a 1xx response (excluding 101 Upgrade). The
listeners of this event will receive an object containing the status code.

```js
const http = require('http');
Expand All @@ -432,8 +435,8 @@ const options = {
const req = http.request(options);
req.end();

req.on('information', (res) => {
console.log(`Got information prior to main response: ${res.statusCode}`);
req.on('information', (info) => {
console.log(`Got information prior to main response: ${info.statusCode}`);
});
```

Expand Down

0 comments on commit 7b37c65

Please sign in to comment.