comparison web/src/luan/modules/web/Http.luan @ 463:895afcd2b281

improve Http.init_for_test
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 06 May 2015 21:44:56 -0600
parents 507c0af598ba
children 55a86fc4701b
comparison
equal deleted inserted replaced
462:2e79b47d02a2 463:895afcd2b281
4 4
5 5
6 6
7 function init_for_test() 7 function init_for_test()
8 8
9 function get_page(mod_name) 9 welcome_file = "index.html"
10
11 function get_page(path)
12 if welcome_file ~= nil and path.matches ".*/" then
13 path = path .. welcome_file
14 end
10 local old_out = Io.stdout 15 local old_out = Io.stdout
11 local mod = require("site:"..mod_name) 16 local mod = require("site:"..path)
12 mod.service() 17 mod.service()
13 text_writer.close() 18 text_writer.close()
14 Io.stdout = old_out 19 Io.stdout = old_out
15 return result.read_text() 20 return result.read_text()
16 end 21 end