lib/reel/request/info.rb in reel-0.5.0 vs lib/reel/request/info.rb in reel-0.6.0.pre1
- old
+ new
@@ -1,21 +1,26 @@
module Reel
class Request
class Info
+
+ CASE_INSENSITVE_HASH = Hash.new do |hash, key|
+ hash[hash.keys.find {|k| k =~ /#{key}/i}] if key
+ end
+
attr_reader :http_method, :url, :http_version, :headers
def initialize(http_method, url, http_version, headers)
@http_method = http_method
@url = url
@http_version = http_version
- @headers = headers
+ @headers = CASE_INSENSITVE_HASH.merge headers
end
UPGRADE = 'Upgrade'.freeze
WEBSOCKET = 'websocket'.freeze
def websocket_request?
headers[UPGRADE] && headers[UPGRADE].downcase == WEBSOCKET
end
end
end
-end
\ No newline at end of file
+end