diff http/src/luan/modules/http/Http.luan @ 508:9218f9cf45d3

various fixes
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 21 May 2015 20:20:54 -0600
parents dbdf4b8193a8
children e3b0846dc2ef
line wrap: on
line diff
--- a/http/src/luan/modules/http/Http.luan	Thu May 21 17:03:57 2015 -0600
+++ b/http/src/luan/modules/http/Http.luan	Thu May 21 20:20:54 2015 -0600
@@ -2,6 +2,7 @@
 local Luan = require "luan:Luan"
 local ipairs = Luan.ipairs
 local pairs = Luan.pairs
+local error = Luan.error
 local set_metatable = Luan.set_metatable
 local Io = require "luan:Io"
 local Html = require "luan:Html"
@@ -15,7 +16,7 @@
 
 function singular_metatable.__index(table,key)
 	local list = table.__plural[key]
-	return list and list[1]
+	return list and (list[1] or error("invalid value "..list.." for "..key))
 end
 
 function singular_metatable.__new_index(table,key,value)
@@ -94,11 +95,11 @@
 		this.send_error = this.java.sendError
 
 		function this.set_cookie(name,value,is_persistent,domain)
-			HttpServicer.setCookie(this.java,M.response.java,name,value,is_persistent,domain)
+			HttpServicer.setCookie(M.request.java,this.java,name,value,is_persistent,domain)
 		end
 
 		function this.remove_cookie(name,domain)
-			HttpServicer.removeCookie(this.java,M.response.java,name,domain)
+			HttpServicer.removeCookie(M.request.java,this.java,name,domain)
 		end
 
 		function this.text_writer()