lib/api_auth/headers.rb in api-auth-1.0.3 vs lib/api_auth/headers.rb in api-auth-1.1.0
- old
+ new
@@ -25,44 +25,46 @@
end
when /ActionDispatch::Request/
@request = ActionDispatchRequest.new(request)
when /Rack::Request/
@request = RackRequest.new(request)
+ when /ActionController::CgiRequest/
+ @request = ActionControllerRequest.new(request)
else
raise UnknownHTTPRequest, "#{request.class.to_s} is not yet supported."
end
true
end
-
+
# Returns the request timestamp
def timestamp
- @request.timestamp
+ @request.timestamp
end
# Returns the canonical string computed from the request's headers
def canonical_string
[ @request.content_type,
@request.content_md5,
- @request.request_uri.gsub(/http:\/\/[^(,|\?|\/)]*/,''), # remove host
+ @request.request_uri.gsub(/https?:\/\/[^(,|\?|\/)]*/,''), # remove host
@request.timestamp
].join(",")
end
# Returns the authorization header from the request's headers
def authorization_header
@request.authorization_header
end
def set_date
- @request.set_date if @request.timestamp.blank?
+ @request.set_date if @request.timestamp.empty?
end
def calculate_md5
- @request.populate_content_md5 if @request.content_md5.blank?
+ @request.populate_content_md5 if @request.content_md5.empty?
end
def md5_mismatch?
- if @request.content_md5.blank?
+ if @request.content_md5.empty?
false
else
@request.md5_mismatch?
end
end