Browse Source

Fix server-redis related to failed tests

Jesterovskiy 9 years ago
parent
commit
f4aab1a91a

+ 1 - 1
frameworks/Crystal/kemal/server-postgres.cr

@@ -9,7 +9,7 @@ DB = PG.connect("postgres://benchmarkdbuser:benchmarkdbpass@#{ENV["DBHOST"]? ||
 
 
 class CONTENT
 class CONTENT
   UTF8 = "; charset=UTF-8"
   UTF8 = "; charset=UTF-8"
-  JSON = "application/json" + UTF8
+  JSON = "application/json"
   PLAIN = "text/plain"
   PLAIN = "text/plain"
   HTML = "text/html" + UTF8
   HTML = "text/html" + UTF8
 end
 end

+ 8 - 2
frameworks/Crystal/kemal/server-redis.cr

@@ -9,9 +9,9 @@ REDIS = Redis.new
 
 
 class CONTENT
 class CONTENT
   UTF8 = "; charset=UTF-8"
   UTF8 = "; charset=UTF-8"
-  JSON = "application/json" #+ UTF8
+  JSON = "application/json"
   PLAIN = "text/plain"
   PLAIN = "text/plain"
-  HTML = "text/html" #+ UTF8
+  HTML = "text/html"
 end
 end
 
 
 ID_MAXIMUM = 10_000
 ID_MAXIMUM = 10_000
@@ -39,6 +39,7 @@ end
 
 
 private def sanitizedQueryCount(request)
 private def sanitizedQueryCount(request)
   queries = request.params["queries"] as String
   queries = request.params["queries"] as String
+  return 1 if queries.empty? || queries.to_i?.nil?
   if queries.to_i > 500
   if queries.to_i > 500
     queries = 500
     queries = 500
   elsif queries.to_i < 1
   elsif queries.to_i < 1
@@ -47,6 +48,11 @@ private def sanitizedQueryCount(request)
   queries.to_i
   queries.to_i
 end
 end
 
 
+before_all do |env|
+  env.response.headers["Server"] = "Kemal"
+  env.response.headers["Date"] = Time.now.to_s
+end
+
 #
 #
 # Basic Tests
 # Basic Tests
 #
 #