Mercurial Hosting > luan
diff src/luan/modules/http/Http_test.luan @ 1088:bae2d0c2576c
change module naming convention
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 26 Dec 2016 22:29:36 -0700 |
parents | 9c13a15a4002 |
children | 1f4da56abd4f |
line wrap: on
line diff
--- a/src/luan/modules/http/Http_test.luan Mon Dec 19 01:38:21 2016 -0700 +++ b/src/luan/modules/http/Http_test.luan Mon Dec 26 22:29:36 2016 -0700 @@ -9,15 +9,15 @@ local Http = require "luan:http/Http.luan" -local M = {} +local Http_test = {} -M.welcome_file = "index.html" -M.cookie = {} +Http_test.welcome_file = "index.html" +Http_test.cookie = {} -function M.get_page(path) +function Http_test.get_page(path) Http.request.path = path - if M.welcome_file ~= nil and matches(path,"/$") then - path = path .. M.welcome_file + if Http_test.welcome_file ~= nil and matches(path,"/$") then + path = path .. Http_test.welcome_file end local old_out = Io.stdout try { @@ -30,34 +30,34 @@ not_found or error(path.." not found") not_found() end - M.text_writer.close() + Http_test.text_writer.close() end finally = function() Io.stdout = old_out end } - return M.result.read_text() + return Http_test.result.read_text() end -function M.init() +function Http_test.init() Http.request = Http.new_request{} - Http.request.cookie = M.cookie + Http.request.cookie = Http_test.cookie Http.response = Http.new_response{ text_writer = function() Http.sent_headers(Http.response.headers) - M.result = Io.uri "string:" - M.text_writer = M.result.text_writer() - return M.text_writer + Http_test.result = Io.uri "string:" + Http_test.text_writer = Http_test.result.text_writer() + return Http_test.text_writer end set_cookie = function(name,value) - M.cookie[name] = value + Http_test.cookie[name] = value end remove_cookie = function(name) - M.cookie[name] = nil + Http_test.cookie[name] = nil end send_redirect = function(url) @@ -72,4 +72,4 @@ end -return M +return Http_test