Open d9k opened 6 years ago
start-server.lua
:
for http://127.0.0.1:8083/test/url_params?a=1&b=2
:
in function(req,res,cap)
:
> req.parsed_url
{authority = "127.0.0.1:8083", host = "127.0.0.1", path = "/", port = "8083", query = "a=1&b=2", scheme = "http"} --[[table: 0x14ad6a0]]
> cap
{"test/url_params"}
so I patched start-server.lua
:
at the end of function(req,res,cap)
:
req.cmd_url = "/index.lua?"..conf.route_parameter.."="..vars[1].."/"..get
if req.parsed_url.query then
req.cmd_url = req.cmd_url .. '&' .. req.parsed_url.query
end
else
req.cmd_url = "/index.lua"
end
return "reparse"
end
new lines are:
if req.parsed_url.query then
req.cmd_url = req.cmd_url .. '&' .. req.parsed_url.query
end
example:
http://127.0.0.1:8083/test/url_params?a=1&b=2
a
andb
params are NOT inpage.GET
table.For the case of
http://127.0.0.1:8083/test/url_params&a=1&b=2
a
andb
params appear inpage.GET
table (but this url is wrong!).