doc: improve the doc of the 'information' event
- Add missing argument - Reword a sentence - Rename the `res` argument to `info` in the example to avoid confusion PR-URL: https://github.com/nodejs/node/pull/27009 Fixes: https://github.com/nodejs/node/issues/26905 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
This commit is contained in:
parent
dada2eba93
commit
0a5a762a16
@ -416,8 +416,11 @@ the client should send the request body.
|
|||||||
added: v10.0.0
|
added: v10.0.0
|
||||||
-->
|
-->
|
||||||
|
|
||||||
Emitted when the server sends a 1xx response (excluding 101 Upgrade). This
|
* `info` {Object}
|
||||||
event is emitted with a callback containing an object with a status code.
|
* `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
|
```js
|
||||||
const http = require('http');
|
const http = require('http');
|
||||||
@ -432,8 +435,8 @@ const options = {
|
|||||||
const req = http.request(options);
|
const req = http.request(options);
|
||||||
req.end();
|
req.end();
|
||||||
|
|
||||||
req.on('information', (res) => {
|
req.on('information', (info) => {
|
||||||
console.log(`Got information prior to main response: ${res.statusCode}`);
|
console.log(`Got information prior to main response: ${info.statusCode}`);
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user