summaryrefslogtreecommitdiffstats
path: root/scripts/ci/openresty/post-api.lua
blob: 3f22960b3c8e9fb44214c8ca6c4b7dca020022db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
-- Simple API for checking POST data

-- Get the request path
local reqPath = ngx.var.uri
-- Get the request method (POST, GET etc..)
local reqMethod = ngx.var.request_method
-- Get any URI arguments
local uriArgs = ngx.req.get_uri_args()
-- Get any POST arguments
ngx.req.read_body()
local postArgs = ngx.req.get_post_args()

-- We only reply to POST requests
if reqMethod ~= "POST"
then
    return false
end

ngx.say("Section: ", uriArgs.section, ", User: ", postArgs.user)