diff options
author | James M Snell <jasnell@gmail.com> | 2018-10-26 15:09:16 -0700 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2018-10-30 08:47:31 -0700 |
commit | bd8c1078941a7a6de93892fe529868adee357917 (patch) | |
tree | b24ae609fcb4a6ae11630c5ad8c3aaa396caeb91 /doc/api/http.md | |
parent | f24b070cb7fb04df6249fab5264df2146e2b6cac (diff) | |
download | android-node-v8-bd8c1078941a7a6de93892fe529868adee357917.tar.gz android-node-v8-bd8c1078941a7a6de93892fe529868adee357917.tar.bz2 android-node-v8-bd8c1078941a7a6de93892fe529868adee357917.zip |
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/api/http.md')
-rw-r--r-- | doc/api/http.md | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/doc/api/http.md b/doc/api/http.md index cf3faac293..ff948cd9f5 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 +<!-- 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 |