我正在尝试按照此 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.
谁能帮我理解这里的问题?我需要在我的插件中记录请求正文。