Всё прекрасно работает прямо по примерам, нагугленным из интернетов. Нужна библиотека luasocket.
local http = require "socket.http"
local ltn12 = require "ltn12"
local reqbody = "{post body}"
local respbody = {} -- for the response body
local result, respcode, respheaders, respstatus = http.request {
method = "POST",
url = "https://httpbin.org/post",
source = ltn12.source.string(reqbody),
headers = {
["content-type"] = "text/plain",
["content-length"] = tostring(#reqbody)
},
sink = ltn12.sink.table(respbody)
}
-- get body as string by concatenating table filled by sink
respbody = table.concat(respbody)
print (result)
print (respcode)
print (respheaders)
print (respstatus)
print (respbody)