Skip to content

Commit 70f60c9

Browse files
antoine-amaraMylesBorins
authored andcommitted
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: #15501 Fixes: #15390 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
1 parent baeb46a commit 70f60c9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

doc/api/http2.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,7 +1147,8 @@ of the given file:
11471147

11481148
If an error occurs while attempting to read the file data, the `Http2Stream`
11491149
will be closed using an `RST_STREAM` frame using the standard `INTERNAL_ERROR`
1150-
code.
1150+
code. If the `onError` callback is defined it will be called, otherwise
1151+
the stream will be destroyed.
11511152

11521153
Example using a file path:
11531154

@@ -1170,7 +1171,7 @@ server.on('stream', (stream) => {
11701171

11711172
stream.respondWithFile('/some/file',
11721173
{ 'content-type': 'text/plain' },
1173-
{ statCheck });
1174+
{ statCheck, onError });
11741175
});
11751176
```
11761177

0 commit comments

Comments
 (0)