diff http/src/luan/modules/http/Http_test.luan @ 572:f1601a4ce1aa

fix stack when calling meta-methods
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 12 Jul 2015 21:34:23 -0600
parents cd944b010f25
children 1e69d9c21461
line wrap: on
line diff
--- a/http/src/luan/modules/http/Http_test.luan	Wed Jul 08 23:10:52 2015 -0600
+++ b/http/src/luan/modules/http/Http_test.luan	Sun Jul 12 21:34:23 2015 -0600
@@ -1,8 +1,12 @@
+local Luan = require "luan:Luan"
+local error = Luan.error
+local set_metatable = Luan.set_metatable or error()
 local Io = require "luan:Io"
 local String = require "luan:String"
-local matches = String.matches
+local matches = String.matches or error()
 local Http = require "luan:http/Http"
 
+
 local M = {}
 
 M.welcome_file = "index.html"
@@ -27,7 +31,7 @@
 	Http.response = Http.new_response{
 
 		text_writer = function()
-			Http.response.headers = nil
+			set_metatable(Http.response.headers,M.sent_error_metatable)
 			M.result = Io.uri "string:"
 			M.text_writer = M.result.text_writer()
 			return M.text_writer