diff src/luan/modules/http/impl/Http.luan @ 1164:1f9d34a6f308

remove assertions
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 07 Feb 2018 17:36:38 -0700
parents fef8f0742da9
children 668f29bc52ea
line wrap: on
line diff
--- a/src/luan/modules/http/impl/Http.luan	Tue Feb 06 22:04:47 2018 -0700
+++ b/src/luan/modules/http/impl/Http.luan	Wed Feb 07 17:36:38 2018 -0700
@@ -1,7 +1,6 @@
 java()
 local Luan = require "luan:Luan.luan"
 local error = Luan.error
-local assert_string = Luan.assert_string or error()
 local ipairs = Luan.ipairs or error()
 local pairs = Luan.pairs or error()
 local type = Luan.type or error()
@@ -15,7 +14,7 @@
 local matches = String.matches or error()
 local HttpServicer = require "java:luan.modules.http.impl.HttpServicer"
 local IoLuan = require "java:luan.modules.IoLuan"
-local LuanJava = require "java:luan.Luan"
+local JavaLuan = require "java:luan.Luan"
 local Response = require "java:luan.webserver.Response"
 local ResponseOutputStream = require "java:luan.webserver.ResponseOutputStream"
 local Status = require "java:luan.webserver.Status"
@@ -39,9 +38,9 @@
 		this.raw_path = java.rawPath or error()
 		this.path = java.path or error()
 		this.protocol = java.protocol or error()
-		this.headers = LuanJava.toLuan(java.headers)
-		this.parameters = LuanJava.toLuan(java.parameters)
-		this.cookies = LuanJava.toLuan(java.cookies)
+		this.headers = JavaLuan.toLuan(java.headers)
+		this.parameters = JavaLuan.toLuan(java.parameters)
+		this.cookies = JavaLuan.toLuan(java.cookies)
 	end
 	this.scheme = "http"
 
@@ -97,8 +96,8 @@
 		attributes = attributes or {}
 		local attrMap = HashMap.new()
 		for attr_name, attr_value in pairs(attributes) do
-			assert_string(attr_name)
-			assert_string(attr_value)
+			type(attr_name)=="string" or "cookie attribute name must be string"
+			type(attr_value)=="string" or "cookie attribute value must be string"
 			attrMap.put(attr_name,attr_value)
 		end
 		this.java.setCookie(name,value,attrMap)
@@ -137,8 +136,8 @@
 	local java = response.java or error()
 	java.status = Status.getStatus(response.status)
 	for name, value in pairs(response.headers) do
-		assert_string(name)
-		value = LuanJava.toJava(value)
+		type(name)=="string" or "header name must be string"
+		value = JavaLuan.toJava(value)
 		java.headers.put(name,value)
 	end
 	response.writer and response.writer.close()