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 @@ -1496,6 +1496,34 @@ added: v10.1.0
1496
1496
The ` message.aborted ` property will be ` true ` if the request has
1497
1497
been aborted.
1498
1498
1499
+ ### message.complete
1500
+ <!-- YAML
1501
+ added: v0.3.0
1502
+ -->
1503
+
1504
+ * {boolean}
1505
+
1506
+ The ` message.complete ` property will be ` true ` if a complete HTTP message has
1507
+ been received and successfully parsed.
1508
+
1509
+ This property is particularly useful as a means of determining if a client or
1510
+ server fully transmitted a message before a connection was terminated:
1511
+
1512
+ ``` js
1513
+ const req = http .request ({
1514
+ host: ' 127.0.0.1' ,
1515
+ port: 8080 ,
1516
+ method: ' POST'
1517
+ }, (res ) => {
1518
+ res .resume ();
1519
+ res .on (' end' , () => {
1520
+ if (! res .complete )
1521
+ console .error (
1522
+ ' The connection was terminated while the message was still being sent' );
1523
+ });
1524
+ });
1525
+ ```
1526
+
1499
1527
### message.destroy([ error] )
1500
1528
<!-- YAML
1501
1529
added: v0.3.0
You can’t perform that action at this time.
0 commit comments