Browse Source

[YQTemplate] Read all args in a table

main
Annwan 4 months ago
parent
commit
722d75360f
  1. 8
      yqtemplate.lua

8
yqtemplate.lua

@ -11,11 +11,15 @@ return {
fcgi.print("Content-Type: text/html; charset=utf-8\r\n\r\n") fcgi.print("Content-Type: text/html; charset=utf-8\r\n\r\n")
local data = "" local data = ""
if fcgi.getenv("REQUEST_METHOD") == "POST" then if fcgi.getenv("REQUEST_METHOD") == "POST" then
--- @type string
local content_type = fcgi.getenv("CONTENT_TYPE") local content_type = fcgi.getenv("CONTENT_TYPE")
local boundary = content_type:match("; boundary=(.*)$") local boundary = content_type:match("; boundary=(.*)$")
-- local post_data = fcgi.post()
local post_data = fcgi.post()
data = "Content type:" .. content_type .. "\n Boundary: "..boundary.."\n" data = "Content type:" .. content_type .. "\n Boundary: "..boundary.."\n"
local args = {}
for w in string.gmatch(post_data, "(.-)"..boundary) do
args[#args+1] = w
end
data = table.concat(args, "\n\n")
end end
fcgi.print(form{data = data}) fcgi.print(form{data = data})
end end

Loading…
Cancel
Save