Replies: 1 comment
-
|
可以用 enable 禁用后,直接参考内置的 https://github.com/midwayjs/midway/blob/v4-next/packages/web-koa/src/middleware/bodyparser.middleware.ts#L5C14-L5C34 写一个,append 到 SiteFileMiddleware 中间件之后就行。 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The feature, motivation(功能、动机)
koa body paser 提前解析可能会影响某些第三方中间件的使用,例如:
https://github.com/panva/node-oidc-provider/blob/main/lib/shared/selective_body.js#L25
Alternatives(替代方案)
ctx.disableBodyParser = true将 enable 改成enable?: boolean | ((ctx: IMidwayKoaContext) => boolean),但是中间件 resolve 没有 ctx 参数Additional context(其他上下文)
No response
Beta Was this translation helpful? Give feedback.
All reactions