lib/api_auth/request_drivers/http.rb in api-auth-2.4.1 vs lib/api_auth/request_drivers/http.rb in api-auth-2.5.0

- old
+ new

@@ -10,23 +10,23 @@ def set_auth_header(header) @request['Authorization'] = header @request end - def calculated_md5 - md5_base64digest(body) + def calculated_hash + sha256_base64digest(body) end - def populate_content_md5 + def populate_content_hash return unless %w[POST PUT].include?(http_method) - @request['Content-MD5'] = calculated_md5 + @request['X-Authorization-Content-SHA256'] = calculated_hash end - def md5_mismatch? + def content_hash_mismatch? if %w[POST PUT].include?(http_method) - calculated_md5 != content_md5 + calculated_hash != content_hash else false end end @@ -36,11 +36,11 @@ def content_type find_header(%w[CONTENT-TYPE CONTENT_TYPE HTTP_CONTENT_TYPE]) end - def content_md5 - find_header(%w[CONTENT-MD5 CONTENT_MD5]) + def content_hash + find_header(%w[X-AUTHORIZATION-CONTENT-SHA256]) end def original_uri find_header(%w[X-ORIGINAL-URI X_ORIGINAL_URI HTTP_X_ORIGINAL_URI]) end