Skip to content

Commit 220b32d

Browse files
committed
docs: clarify runMiddlewareChainIgnoringResults now merges standard Express properties
1 parent ee2e4c1 commit 220b32d

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

packages/express-wrapper/src/middleware.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,14 +189,19 @@ export async function runMiddlewareChain<
189189
}
190190

191191
/**
192-
* Runs a middleware chain, but does not modify the decoded request (input) with properties from any middleware.
192+
* Runs a middleware chain and merges standard Express properties (body, query, params, headers) with the decoded request.
193+
* Does not incorporate other modifications middleware may make to the request object.
193194
* This primarily exists to preserve backwards-compatible behavior for RouteHandlers defined without the `routeHandler` function.
194195
*
195-
* @param input - the decoded request properties (just passed through)
196+
* Note: The name "IgnoringResults" refers to ignoring typed middleware return values (via middlewareFn),
197+
* NOT ignoring standard Express request modifications. Middleware can still modify req.body/query/params/headers
198+
* and those changes WILL be included in the returned object.
199+
*
200+
* @param _input - the decoded request properties (unused, decoded data is read from req)
196201
* @param chain - the middleware chain
197202
* @param req - express request object
198203
* @param res - express response object
199-
* @returns `input` unmodified
204+
* @returns decoded request merged with req.body, req.query, req.params, and req.headers
200205
*/
201206
export async function runMiddlewareChainIgnoringResults<
202207
Input,

0 commit comments

Comments
 (0)