-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
在监听request的回调中拿不到ctx.request.body #3404
Comments
是的,这个是请求才进入,还未开始处理,可以自己写个中间件拦截。 |
还是说下你的原始诉求吧 |
Hello @menkeydyvh. Please provide a reproducible example following the instruction. Issues labeled by @menkeydyvh,请根据这个说明提供最小可复现代码。 如果在 7 天内没有进展会被自动关闭。 |
@popomore 有没有 request after 可以监听到ctx.request.body 或者ctx.request.rowbody有数据的时候? |
@atian25 做一个请求日志记录 看到别人是用这样监听的 但是监听的ctx.request.body 是还没被解析出来的 |
你看的是 Express 的吧, Koa 不需要这样,可以了解下洋葱模型。 直接写个 Middleware 分别在 |
@atian25 嗯 我后续也改成这样了 如果在这个事件框架还没解析这个那我只能去中间件处理了 |
在 Koa 里面,尽可能少用这些事件。中间件很简单的,几句话搞定。 |
在使用
app.on('request', ctx => {
//拿不到下面这个的值
ctx.request.body
});
相关环境信息
The text was updated successfully, but these errors were encountered: