cosmopolitan/tool/net/demo/printpayload.lua
2022-10-06 16:27:23 -07:00

12 lines
282 B
Lua

local function main()
if GetMethod() ~= 'POST' and GetMethod() ~= 'PUT' then
ServeError(405)
SetHeader('Allow', 'POST, PUT')
return
end
SetStatus(200)
SetHeader("Content-Type", GetHeader("Content-Type") or "text/plain")
Write(GetBody())
end
main()