| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 82ee6c3 commit 24c6a02
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1500,6 +1500,34 @@ added: v10.1.0 | |||
| 1500 | 1500 | The `message.aborted` property will be `true` if the request has | |
| 1501 | 1501 | been aborted. | |
| 1502 | 1502 | ||
| 1503 | + ### message.complete | ||
| 1504 | + <!-- YAML | ||
| 1505 | + added: v0.3.0 | ||
| 1506 | + --> | ||
| 1507 | + | ||
| 1508 | + * {boolean} | ||
| 1509 | + | ||
| 1510 | + The `message.complete` property will be `true` if a complete HTTP message has | ||
| 1511 | + been received and successfully parsed. | ||
| 1512 | + | ||
| 1513 | + This property is particularly useful as a means of determining if a client or | ||
| 1514 | + server fully transmitted a message before a connection was terminated: | ||
| 1515 | + | ||
| 1516 | + ```js | ||
| 1517 | + const req = http.request({ | ||
| 1518 | + host: '127.0.0.1', | ||
| 1519 | + port: 8080, | ||
| 1520 | + method: 'POST' | ||
| 1521 | + }, (res) => { | ||
| 1522 | + res.resume(); | ||
| 1523 | + res.on('end', () => { | ||
| 1524 | + if (!res.complete) | ||
| 1525 | + console.error( | ||
| 1526 | + 'The connection was terminated while the message was still being sent'); | ||
| 1527 | + }); | ||
| 1528 | + }); | ||
| 1529 | + ``` | ||
| 1530 | + | ||
| 1503 | 1531 | ### message.destroy([error]) | |
| 1504 | 1532 | <!-- YAML | |
| 1505 | 1533 | added: v0.3.0 | |
| Back | FazBrowse Home | New Git URL |
0 commit comments