Skip to content

Commit 0bf6b9e

Browse files
committed
update docs for next() vs opts.onNoMatch
1 parent 45b73c6 commit 0bf6b9e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/sirv/readme.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Returns: `Function`
4848

4949
The returned function is a middleware in the standard Express-like signature: `(req, res, next)`, where `req` is the [`http.IncomingMessage`](https://nodejs.org/api/http.html#http_class_http_incomingmessage), `res` is the [`http.ServerResponse`](https://nodejs.org/dist/latest-v9.x/docs/api/http.html#http_class_http_serverresponse), and `next` (in this case) is the function to call if no file was found for the given path.
5050

51-
For `sirv`, the `next()` callback is functionally synonymous with [`opts.onNoMatch`](#optsonnomatch); however `next()` is given priority if/when defined.
51+
For `sirv`, the `next()` callback is functionally synonymous with [`opts.onNoMatch`](#optsonnomatch); however `next()` is given priority if/when defined and **will not** receive the `res` as an argument.
5252

5353
#### dir
5454
Type: `String`<br>
@@ -93,11 +93,11 @@ Appends the [`immutable` directive](https://developer.mozilla.org/en-US/docs/Web
9393
#### opts.onNoMatch
9494
Type: `Function`
9595

96-
A custom function to run if a file cannot be found for a given request. By default, `sirv` will send a basic `(404) Not found` response.
96+
A custom function to run if a file cannot be found for a given request. <br>By default, `sirv` will send a basic `(404) Not found` response.
9797

9898
The function receives the current `res <ServerResponse>` as its only argument.
9999

100-
> **Note:** This can only be replaced if a `next` callback has been provided to the middleware; see [`sirv`](#sirvdir-opts) description.
100+
> **Note:** This won't run if a `next` callback has been provided to the middleware; see [`sirv`](#sirvdir-opts) description.
101101
102102
#### opts.setHeaders
103103
Type: `Function`

0 commit comments

Comments
 (0)