Make headers argument optional

This commit is contained in:
Basti 2023-11-21 15:18:13 +01:00
parent 589dcf7fa2
commit 209fcca5ea
Signed by: basti
GPG Key ID: 9F88009D31D99C72

View File

@ -49,14 +49,14 @@ module RemoteStorage
def do_head_request(url, &block) def do_head_request(url, &block)
deal_with_unauthorized_requests do deal_with_unauthorized_requests do
auth_headers = auth_headers_for("HEAD", url, {}) auth_headers = auth_headers_for("HEAD", url)
RestClient.head(url, auth_headers, &block) RestClient.head(url, auth_headers, &block)
end end
end end
def do_delete_request(url) def do_delete_request(url)
deal_with_unauthorized_requests do deal_with_unauthorized_requests do
auth_headers = auth_headers_for("DELETE", url, {}) auth_headers = auth_headers_for("DELETE", url)
RestClient.delete(url, auth_headers) RestClient.delete(url, auth_headers)
end end
end end
@ -75,7 +75,7 @@ module RemoteStorage
return found return found
end end
def auth_headers_for(http_method, url, headers, data = nil) def auth_headers_for(http_method, url, headers = {}, data = nil)
signature = s3_signer.sign_request( signature = s3_signer.sign_request(
http_method: http_method, url: url, headers: headers, body: data http_method: http_method, url: url, headers: headers, body: data
) )