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: nodejs#15501
Fixes: nodejs#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 Sep 28, 2017
1 parent 212a8d8 commit 2ed0d1d
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
@@ -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 });
});
```

0 comments on commit 2ed0d1d

Please sign in to comment.