Skip to content

Commit

Permalink
doc: add documentation for http.IncomingMessage$complete
Browse files Browse the repository at this point in the history
Fixes: #8102

PR-URL: #23914
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
  • Loading branch information
jasnell authored and MylesBorins committed Nov 27, 2018
1 parent ddfb22f commit 3c46c03
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions doc/api/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -1496,6 +1496,34 @@ added: v10.1.0
The `message.aborted` property will be `true` if the request has
been aborted.

### message.complete
<!-- YAML
added: v0.3.0
-->

* {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])
<!-- YAML
added: v0.3.0
Expand Down

0 comments on commit 3c46c03

Please sign in to comment.