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 <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
  • Loading branch information
jasnell authored and rvagg committed Nov 28, 2018
1 parent 3025f35 commit 6d76f85
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 @@ -1441,6 +1441,34 @@ added: v8.13.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 6d76f85

Please sign in to comment.