Mercurial Hosting > luan
diff src/luan/modules/http/tools/Run.luan @ 1607:fa066aaa068c
nginx caching
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 30 Apr 2021 20:23:28 -0600 |
parents | d9a5405a3102 |
children | d6ec67fa4a61 |
line wrap: on
line diff
--- a/src/luan/modules/http/tools/Run.luan Tue Apr 20 18:06:50 2021 -0600 +++ b/src/luan/modules/http/tools/Run.luan Fri Apr 30 20:23:28 2021 -0600 @@ -26,7 +26,9 @@ end end -local function form() %> +local function form() + Http.response.headers["Content-Type"] = "text/html; charset=utf-8" +%> <!doctype html> <html> <head> @@ -54,7 +56,6 @@ <body> <h2>Run Luan Code</h2> <form method="post"> - <input type="hidden" name="content_type" value="text/plain; charset=utf-8" /> <div> <textarea name="code" rows="20" cols="90" autofocus></textarea> </div> @@ -64,16 +65,18 @@ </form> </body> </html> -<% end +<% +end function Run.run(code,source_name) try + Http.response.headers["Content-Type"] = "text/plain; charset=utf-8" local run = load(code,source_name) run() return true catch e Http.response.reset() - Http.response.headers["content-type"] = "text/plain; charset=utf-8" + Http.response.headers["Content-Type"] = "text/plain; charset=utf-8" Io.stdout = Http.response.text_writer() print(e) print() @@ -84,10 +87,6 @@ end function Run.respond() - local content_type = Http.request.parameters.content_type - if content_type ~= nil then - Http.response.headers["content-type"] = content_type - end Io.stdout = Http.response.text_writer() local code = Http.request.parameters.code if code == nil then