lib/api_auth/request_drivers/rack.rb in api-auth-2.1.0 vs lib/api_auth/request_drivers/rack.rb in api-auth-2.2.0
- old
+ new
@@ -24,17 +24,17 @@
end
md5_base64digest(body)
end
def populate_content_md5
- return unless %w(POST PUT).include?(@request.request_method)
+ return unless %w[POST PUT].include?(@request.request_method)
@request.env['Content-MD5'] = calculated_md5
fetch_headers
end
def md5_mismatch?
- if %w(POST PUT).include?(@request.request_method)
+ if %w[POST PUT].include?(@request.request_method)
calculated_md5 != content_md5
else
false
end
end
@@ -46,34 +46,35 @@
def http_method
@request.request_method.upcase
end
def content_type
- value = find_header(%w(CONTENT-TYPE CONTENT_TYPE HTTP_CONTENT_TYPE))
- value.nil? ? '' : value
+ find_header(%w[CONTENT-TYPE CONTENT_TYPE HTTP_CONTENT_TYPE])
end
def content_md5
- value = find_header(%w(CONTENT-MD5 CONTENT_MD5 HTTP-CONTENT-MD5 HTTP_CONTENT_MD5))
- value.nil? ? '' : value
+ find_header(%w[CONTENT-MD5 CONTENT_MD5 HTTP-CONTENT-MD5 HTTP_CONTENT_MD5])
end
+ def original_uri
+ find_header(%w[X-ORIGINAL-URI X_ORIGINAL_URI HTTP_X_ORIGINAL_URI])
+ end
+
def request_uri
@request.fullpath
end
def set_date
@request.env['DATE'] = Time.now.utc.httpdate
fetch_headers
end
def timestamp
- value = find_header(%w(DATE HTTP_DATE))
- value.nil? ? '' : value
+ find_header(%w[DATE HTTP_DATE])
end
def authorization_header
- find_header %w(Authorization AUTHORIZATION HTTP_AUTHORIZATION)
+ find_header %w[Authorization AUTHORIZATION HTTP_AUTHORIZATION]
end
private
def find_header(keys)