diff --git a/doc/api/http2.md b/doc/api/http2.md index 57e1b74e7e9edc..7c1fe2c765601d 100755 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -849,6 +849,15 @@ used exclusively on HTTP/2 Clients. `Http2Stream` instances on the client provide events such as `'response'` and `'push'` that are only relevant on the client. +#### Event: 'continue' + + +Emitted when the server sends a `100 Continue` status, usually because +the request contained `Expect: 100-continue`. This is an instruction that +the client should send the request body. + #### Event: 'headers' + +* `request` {http2.Http2ServerRequest} +* `response` {http2.Http2ServerResponse} + +If a [`'request'`][] listener is registered or [`'http2.createServer()'`][] is +supplied a callback function, the `'checkContinue'` event is emitted each time +a request with an HTTP `Expect: 100-continue` is received. If this event is +not listened for, the server will automatically respond with a status +`100 Continue` as appropriate. + +Handling this event involves calling [`response.writeContinue()`][] if the client +should continue to send the request body, or generating an appropriate HTTP +response (e.g. 400 Bad Request) if the client should not continue to send the +request body. + +Note that when this event is emitted and handled, the [`'request'`][] event will +not be emitted. + ### Class: Http2SecureServer +#### Event: 'checkContinue' + + +* `request` {http2.Http2ServerRequest} +* `response` {http2.Http2ServerResponse} + +If a [`'request'`][] listener is registered or [`'http2.createSecureServer()'`][] +is supplied a callback function, the `'checkContinue'` event is emitted each +time a request with an HTTP `Expect: 100-continue` is received. If this event +is not listened for, the server will automatically respond with a status +`100 Continue` as appropriate. + +Handling this event involves calling [`response.writeContinue()`][] if the client +should continue to send the request body, or generating an appropriate HTTP +response (e.g. 400 Bad Request) if the client should not continue to send the +request body. + +Note that when this event is emitted and handled, the [`'request'`][] event will +not be emitted. + ### http2.createServer(options[, onRequestHandler]) -Throws an error as the `'continue'` flow is not current implemented. Added for -parity with [HTTP/1](). +Sends a status `100 Continue` to the client, indicating that the request body +should be sent. See the [`'checkContinue'`][] event on `Http2Server` and +`Http2SecureServer`. ### response.writeHead(statusCode[, statusMessage][, headers])