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

Fixes: #26905
  • Loading branch information
lpinca committed Mar 30, 2019
1 parent 61ef9df commit bd17e0d
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 bd17e0d

Please sign in to comment.