diff --git a/doc/api/http.md b/doc/api/http.md index cf3faac293fc79..ff948cd9f5d6a6 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -1500,6 +1500,34 @@ added: v10.1.0 The `message.aborted` property will be `true` if the request has been aborted. +### message.complete + + +* {boolean} + +The `message.complete` property will be `true` if a complete HTTP message has +been received and successfully parsed. + +This property is particularly useful as a means of determining if a client or +server fully transmitted a message before a connection was terminated: + +```js +const req = http.request({ + host: '127.0.0.1', + port: 8080, + method: 'POST' +}, (res) => { + res.resume(); + res.on('end', () => { + if (!res.complete) + console.error( + 'The connection was terminated while the message was still being sent'); + }); +}); +``` + ### message.destroy([error])