File tree 1 file changed +28
-0
lines changed
1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -1516,6 +1516,34 @@ added: v10.1.0
1516
1516
The ` message.aborted ` property will be ` true ` if the request has
1517
1517
been aborted.
1518
1518
1519
+ ### message.complete
1520
+ <!-- YAML
1521
+ added: v0.3.0
1522
+ -->
1523
+
1524
+ * {boolean}
1525
+
1526
+ The ` message.complete ` property will be ` true ` if a complete HTTP message has
1527
+ been received and successfully parsed.
1528
+
1529
+ This property is particularly useful as a means of determining if a client or
1530
+ server fully transmitted a message before a connection was terminated:
1531
+
1532
+ ``` js
1533
+ const req = http .request ({
1534
+ host: ' 127.0.0.1' ,
1535
+ port: 8080 ,
1536
+ method: ' POST'
1537
+ }, (res ) => {
1538
+ res .resume ();
1539
+ res .on (' end' , () => {
1540
+ if (! res .complete )
1541
+ console .error (
1542
+ ' The connection was terminated while the message was still being sent' );
1543
+ });
1544
+ });
1545
+ ```
1546
+
1519
1547
### message.destroy([ error] )
1520
1548
<!-- YAML
1521
1549
added: v0.3.0
You can’t perform that action at this time.
0 commit comments