diff --git a/doc/api/http.md b/doc/api/http.md index 46ea8511ffe6b8..6022f3e51519fe 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -400,6 +400,37 @@ Emitted when the server sends a '100 Continue' HTTP response, usually because the request contained 'Expect: 100-continue'. This is an instruction that the client should send the request body. +### Event: 'information' + + +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. + +```js +const http = require('http'); + +const options = { + hostname: '127.0.0.1', + port: 8080, + path: '/length_request' +}; + +// Make a request +const req = http.request(options); +req.end(); + +req.on('information', (res) => { + console.log('got information prior to main response: ' + res.statusCode); +}); +``` + +101 Upgrade statuses do not fire this event due to their break from the +traditional HTTP request/response chain, such as web sockets, in-place TLS +upgrades, or HTTP 2.0. To be notified of 101 Upgrade notices, listen for the +[`'upgrade'`][] event instead. + ### Event: 'response' + +Sends a HTTP/1.1 102 Processing message to the client, indicating that +the request body should be sent. + ## Class: http.IncomingMessage