Skip to content

Commit

Permalink
doc: fix mistake in http2stream.respondWithFile.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
antoine-amara authored and MylesBorins committed Oct 3, 2017
1 parent d1d2ca5 commit 22b2d1a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions doc/api/http2.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

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

stream.respondWithFile('/some/file',
{ 'content-type': 'text/plain' },
{ statCheck });
{ statCheck, onError });
});
```

Expand Down

0 comments on commit 22b2d1a

Please sign in to comment.