@@ -849,6 +849,15 @@ used exclusively on HTTP/2 Clients. `Http2Stream` instances on the client
849
849
provide events such as ` 'response' ` and ` 'push' ` that are only relevant on
850
850
the client.
851
851
852
+ #### Event: 'continue'
853
+ <!-- YAML
854
+ added: REPLACEME
855
+ -->
856
+
857
+ Emitted when the server sends a ` 100 Continue ` status, usually because
858
+ the request contained ` Expect: 100-continue ` . This is an instruction that
859
+ the client should send the request body.
860
+
852
861
#### Event: 'headers'
853
862
<!-- YAML
854
863
added: v8.4.0
@@ -1306,6 +1315,28 @@ added: v8.4.0
1306
1315
The ` 'timeout' ` event is emitted when there is no activity on the Server for
1307
1316
a given number of milliseconds set using ` http2server.setTimeout() ` .
1308
1317
1318
+ #### Event: 'checkContinue'
1319
+ <!-- YAML
1320
+ added: REPLACEME
1321
+ -->
1322
+
1323
+ * ` request ` {http2.Http2ServerRequest}
1324
+ * ` response ` {http2.Http2ServerResponse}
1325
+
1326
+ If a [ ` 'request' ` ] [ ] listener is registered or [ ` 'http2.createServer()' ` ] [ ] is
1327
+ supplied a callback function, the ` 'checkContinue' ` event is emitted each time
1328
+ a request with an HTTP ` Expect: 100-continue ` is received. If this event is
1329
+ not listened for, the server will automatically respond with a status
1330
+ ` 100 Continue ` as appropriate.
1331
+
1332
+ Handling this event involves calling [ ` response.writeContinue() ` ] [ ] if the client
1333
+ should continue to send the request body, or generating an appropriate HTTP
1334
+ response (e.g. 400 Bad Request) if the client should not continue to send the
1335
+ request body.
1336
+
1337
+ Note that when this event is emitted and handled, the [ ` 'request' ` ] [ ] event will
1338
+ not be emitted.
1339
+
1309
1340
### Class: Http2SecureServer
1310
1341
<!-- YAML
1311
1342
added: v8.4.0
@@ -1389,6 +1420,28 @@ per session. See the [Compatibility API](compatiblity-api).
1389
1420
added: v8.4.0
1390
1421
-->
1391
1422
1423
+ #### Event: 'checkContinue'
1424
+ <!-- YAML
1425
+ added: REPLACEME
1426
+ -->
1427
+
1428
+ * ` request ` {http2.Http2ServerRequest}
1429
+ * ` response ` {http2.Http2ServerResponse}
1430
+
1431
+ If a [ ` 'request' ` ] [ ] listener is registered or [ ` 'http2.createSecureServer()' ` ] [ ]
1432
+ is supplied a callback function, the ` 'checkContinue' ` event is emitted each
1433
+ time a request with an HTTP ` Expect: 100-continue ` is received. If this event
1434
+ is not listened for, the server will automatically respond with a status
1435
+ ` 100 Continue ` as appropriate.
1436
+
1437
+ Handling this event involves calling [ ` response.writeContinue() ` ] [ ] if the client
1438
+ should continue to send the request body, or generating an appropriate HTTP
1439
+ response (e.g. 400 Bad Request) if the client should not continue to send the
1440
+ request body.
1441
+
1442
+ Note that when this event is emitted and handled, the [ ` 'request' ` ] [ ] event will
1443
+ not be emitted.
1444
+
1392
1445
### http2.createServer(options[ , onRequestHandler] )
1393
1446
<!-- YAML
1394
1447
added: v8.4.0
@@ -2537,8 +2590,9 @@ buffer. Returns `false` if all or part of the data was queued in user memory.
2537
2590
added: v8.4.0
2538
2591
-->
2539
2592
2540
- Throws an error as the ` 'continue' ` flow is not current implemented. Added for
2541
- parity with [ HTTP/1] ( ) .
2593
+ Sends a status ` 100 Continue ` to the client, indicating that the request body
2594
+ should be sent. See the [ ` 'checkContinue' ` ] [ ] event on ` Http2Server ` and
2595
+ ` Http2SecureServer ` .
2542
2596
2543
2597
### response.writeHead(statusCode[ , statusMessage] [ , headers ] )
2544
2598
<!-- YAML
@@ -2618,6 +2672,7 @@ if the stream is closed.
2618
2672
[ Settings Object ] : #http2_settings_object
2619
2673
[ Using options.selectPadding ] : #http2_using_options_selectpadding
2620
2674
[ Writable Stream ] : stream.html#stream_writable_streams
2675
+ [ `'checkContinue'` ] : #http2_event_checkcontinue
2621
2676
[ `'request'` ] : #http2_event_request
2622
2677
[ `'unknownProtocol'` ] : #http2_event_unknownprotocol
2623
2678
[ `ClientHttp2Stream` ] : #http2_class_clienthttp2stream
@@ -2628,14 +2683,17 @@ if the stream is closed.
2628
2683
[ `ServerRequest` ] : #http2_class_server_request
2629
2684
[ `TypeError` ] : errors.html#errors_class_typeerror
2630
2685
[ `http2.SecureServer` ] : #http2_class_http2secureserver
2686
+ [ `http2.createSecureServer()` ] : #http2_createsecureserver_options_onrequesthandler
2631
2687
[ `http2.Server` ] : #http2_class_http2server
2688
+ [ `http2.createServer()` ] : #http2_createserver_options_onrequesthandler
2632
2689
[ `net.Socket` ] : net.html#net_class_net_socket
2633
2690
[ `request.socket.getPeerCertificate()` ] : tls.html#tls_tlssocket_getpeercertificate_detailed
2634
2691
[ `response.end()` ] : #http2_response_end_data_encoding_callback
2635
2692
[ `response.setHeader()` ] : #http2_response_setheader_name_value
2636
2693
[ `response.socket` ] : #http2_response_socket
2637
2694
[ `response.write()` ] : #http2_response_write_chunk_encoding_callback
2638
2695
[ `response.write(data, encoding)` ] : http.html#http_response_write_chunk_encoding_callback
2696
+ [ `response.writeContinue()` ] : #http2_response_writecontinue
2639
2697
[ `response.writeHead()` ] : #http2_response_writehead_statuscode_statusmessage_headers
2640
2698
[ `stream.pushStream()` ] : #http2_stream-pushstream
2641
2699
[ `tls.TLSSocket` ] : tls.html#tls_class_tls_tlssocket
0 commit comments