docs: A middleware is always responsible for calling downstream (#978)
Irrespective of whether it is called by an upstream middleware or not.
This commit is contained in:
parent
0a7856ca15
commit
beec26ebf8
1 changed files with 1 additions and 1 deletions
|
@ -6,7 +6,7 @@
|
||||||
## Writing Middleware
|
## Writing Middleware
|
||||||
|
|
||||||
Koa middleware are simple functions which return a `MiddlewareFunction` with signature (ctx, next). When
|
Koa middleware are simple functions which return a `MiddlewareFunction` with signature (ctx, next). When
|
||||||
the middleware is run by an "upstream" middleware, it must manually invoke `next()` to run the "downstream" middleware.
|
the middleware is run, it must manually invoke `next()` to run the "downstream" middleware.
|
||||||
|
|
||||||
For example if you wanted to track how long it takes for a request to propagate through Koa by adding an
|
For example if you wanted to track how long it takes for a request to propagate through Koa by adding an
|
||||||
`X-Response-Time` header field the middleware would look like the following:
|
`X-Response-Time` header field the middleware would look like the following:
|
||||||
|
|
Loading…
Reference in a new issue