changeset 463:895afcd2b281

improve Http.init_for_test
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 06 May 2015 21:44:56 -0600
parents 2e79b47d02a2
children eddf7c73373b
files web/src/luan/modules/web/Http.luan
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/web/src/luan/modules/web/Http.luan	Wed May 06 16:54:20 2015 -0600
+++ b/web/src/luan/modules/web/Http.luan	Wed May 06 21:44:56 2015 -0600
@@ -6,9 +6,14 @@
 
 function init_for_test()
 
-	function get_page(mod_name)
+	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:"..mod_name)
+		local mod = require("site:"..path)
 		mod.service()
 		text_writer.close()
 		Io.stdout = old_out