| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 3025f35 commit 6d76f85
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1441,6 +1441,34 @@ added: v8.13.0 | |||
| 1441 | 1441 | The `message.aborted` property will be `true` if the request has | |
| 1442 | 1442 | been aborted. | |
| 1443 | 1443 | ||
| 1444 | + ### message.complete | ||
| 1445 | + <!-- YAML | ||
| 1446 | + added: v0.3.0 | ||
| 1447 | + --> | ||
| 1448 | + | ||
| 1449 | + * {boolean} | ||
| 1450 | + | ||
| 1451 | + The `message.complete` property will be `true` if a complete HTTP message has | ||
| 1452 | + been received and successfully parsed. | ||
| 1453 | + | ||
| 1454 | + This property is particularly useful as a means of determining if a client or | ||
| 1455 | + server fully transmitted a message before a connection was terminated: | ||
| 1456 | + | ||
| 1457 | + ```js | ||
| 1458 | + const req = http.request({ | ||
| 1459 | + host: '127.0.0.1', | ||
| 1460 | + port: 8080, | ||
| 1461 | + method: 'POST' | ||
| 1462 | + }, (res) => { | ||
| 1463 | + res.resume(); | ||
| 1464 | + res.on('end', () => { | ||
| 1465 | + if (!res.complete) | ||
| 1466 | + console.error( | ||
| 1467 | + 'The connection was terminated while the message was still being sent'); | ||
| 1468 | + }); | ||
| 1469 | + }); | ||
| 1470 | + ``` | ||
| 1471 | + | ||
| 1444 | 1472 | ### message.destroy([error]) | |
| 1445 | 1473 | <!-- YAML | |
| 1446 | 1474 | added: v0.3.0 | |
| Back | FazBrowse Home | New Git URL |
0 commit comments