Skip to content

Commit 2ed0d1d

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: nodejs#15501 Fixes: nodejs#15390 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
1 parent 212a8d8 commit 2ed0d1d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

doc/api/http2.md

+3-2
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)