Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2018-10-27 01:09:16 +0300
committerRod Vagg <rod@vagg.org>2018-11-28 03:26:49 +0300
commit6d76f852a9b3c2648d393ac39ca8b2a33574e567 (patch)
treed582eb284b054794ece4a81f7b11441d04330003 /doc
parent3025f351dbf1bc71b25bf4cec7cac24afab75d38 (diff)
doc: add documentation for http.IncomingMessage$complete
Fixes: https://github.com/nodejs/node/issues/8102 PR-URL: https://github.com/nodejs/node/pull/23914 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/api/http.md28
1 files changed, 28 insertions, 0 deletions
diff --git a/doc/api/http.md b/doc/api/http.md
index 6adf88f09db..8fea8ea343f 100644
--- a/doc/api/http.md
+++ b/doc/api/http.md
@@ -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