【发布时间】:2019-08-05 15:58:54
【问题描述】:
我正在尝试通过关注 this url
来读取自定义插件中的请求正文 local data = kong.request.get_body()
if data then
kong.log(data)
end
我收到以下错误
2019/03/14 21:57:55 [error] 14039#0: *45 lua entry thread aborted: runtime error: /usr/local/share/lua/5.1/kong/pdk/private/phases.lua:66: no phase in kong.ctx.core.phase
stack traceback:
coroutine 0:
[C]: in function 'error'
/usr/local/share/lua/5.1/kong/pdk/private/phases.lua:66: in function 'check_phase'
/usr/local/share/lua/5.1/kong/pdk/request.lua:594: in function 'get_body'
.../Apps/troop/kong/plugins/customlog/handler.lua:72: in function <.../Apps/troop/kong/plugins/customlog/handler.lua:62>, context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:8000
Can anyone help me understand the problem here? I need to log the request body in my plugin.
谁能帮我理解这里的问题?我需要在我的插件中记录请求正文。
【问题讨论】:
标签: nginx openresty kong lua-ngx-module kong-plugin