From 0bf6b9ef11adf0c8c7fb5baf50ccfacf8aec8de5 Mon Sep 17 00:00:00 2001 From: Luke Edwards Date: Tue, 15 May 2018 15:20:18 -0700 Subject: [PATCH] update docs for next() vs opts.onNoMatch --- packages/sirv/readme.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/sirv/readme.md b/packages/sirv/readme.md index 4b4048f..4ba501b 100644 --- a/packages/sirv/readme.md +++ b/packages/sirv/readme.md @@ -48,7 +48,7 @@ Returns: `Function` 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. -For `sirv`, the `next()` callback is functionally synonymous with [`opts.onNoMatch`](#optsonnomatch); however `next()` is given priority if/when defined. +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. #### dir Type: `String`
@@ -93,11 +93,11 @@ Appends the [`immutable` directive](https://developer.mozilla.org/en-US/docs/Web #### opts.onNoMatch Type: `Function` -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. +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. The function receives the current `res ` as its only argument. -> **Note:** This can only be replaced if a `next` callback has been provided to the middleware; see [`sirv`](#sirvdir-opts) description. +> **Note:** This won't run if a `next` callback has been provided to the middleware; see [`sirv`](#sirvdir-opts) description. #### opts.setHeaders Type: `Function`