Created
March 9, 2017 23:45
-
-
Save p0pr0ck5/f4c58b2f9bbbe29e2b27b17a6255d3c6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat kong/utils/public.lua | |
local pcall = pcall | |
local ngx_log = ngx.log | |
local ERR = ngx.ERR | |
local _M = {} | |
do | |
local ngx_req_get_post_args = ngx.req.get_post_args | |
function _M.get_post_args() | |
local ok, res, err = ngx_req_get_post_args() | |
if not ok or err then | |
ngx_log(ERR, "could not get body args: ", err) | |
return {} -- TODO return an immutable table here | |
end | |
return res | |
end | |
end | |
return _M |
I think this is missing the necessary logic to either retrieve res
or err
as the message. That is, if we keep the if not ok or err
check.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
bah, ignore the fact that i forgot to use pcall(...) on line 14 :|