annotate src/tools/request.txt.luan @ 51:78b2d6995244

add preview
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 22 Nov 2022 22:57:43 -0700
parents 2f20b11affdd
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5
2f20b11affdd add tools
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1 local Binary = require "luan:Binary.luan"
2f20b11affdd add tools
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2 local Io = require "luan:Io.luan"
2f20b11affdd add tools
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
3 local Http = require "luan:http/Http.luan"
2f20b11affdd add tools
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
4
2f20b11affdd add tools
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
5
2f20b11affdd add tools
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
6 return function()
2f20b11affdd add tools
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
7 Io.stdout = Http.response.text_writer()
2f20b11affdd add tools
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
8 %><%= Http.request.raw_head %><%
2f20b11affdd add tools
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
9 if Http.request.body ~= nil then
2f20b11affdd add tools
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
10 %><%=Binary.to_string(Http.request.body,"utf-8")%><%
2f20b11affdd add tools
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
11 end
2f20b11affdd add tools
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
12 end