Mercurial Hosting > luan
view web/src/luan/modules/web/Http.luan @ 466:55a86fc4701b
move Logging initialization from web/Http to web/Server
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 08 May 2015 11:15:53 -0600 |
parents | 895afcd2b281 |
children |
line wrap: on
line source
local Io = require "luan:Io" function init_for_test() welcome_file = "index.html" function get_page(path) if welcome_file ~= nil and path.matches ".*/" then path = path .. welcome_file end local old_out = Io.stdout local mod = require("site:"..path) mod.service() text_writer.close() Io.stdout = old_out return result.read_text() end cookies = cookies or {} request = { parameters = {}; } request.cookies = cookies response = { text_writer = function() result = Io.uri "string:" text_writer = result.text_writer() return text_writer end; set_cookie = function(name,value) cookies[name] = value end; remove_cookie = function(name) cookies[name] = nil end; send_redirect = function(url) response.redirect = url end; headers = {}; } end