From 22b2d1a786803052a0e26e66c8cb04923ba268f0 Mon Sep 17 00:00:00 2001 From: Antoine AMARA Date: Mon, 18 Sep 2017 22:56:25 +0200 Subject: [PATCH] doc: fix mistake in http2stream.respondWithFile. http2stream.respondWithFile api has changed since 8.5.0 with the addition of the onError option. In the first code example an onError function is implemented but never used, fix this mistake. Add a description to have more informations when onError is triggered. PR-URL: https://github.com/nodejs/node/pull/15501 Fixes: https://github.com/nodejs/node/issues/15390 Reviewed-By: James M Snell Reviewed-By: Luigi Pinca Reviewed-By: Yuta Hiroto Reviewed-By: Ruben Bridgewater --- doc/api/http2.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/api/http2.md b/doc/api/http2.md index 1fd50e971df912..b745b6fb3e0df6 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -1147,7 +1147,8 @@ of the given file: If an error occurs while attempting to read the file data, the `Http2Stream` will be closed using an `RST_STREAM` frame using the standard `INTERNAL_ERROR` -code. +code. If the `onError` callback is defined it will be called, otherwise +the stream will be destroyed. Example using a file path: @@ -1170,7 +1171,7 @@ server.on('stream', (stream) => { stream.respondWithFile('/some/file', { 'content-type': 'text/plain' }, - { statCheck }); + { statCheck, onError }); }); ```