Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken calls to get_object_http_url #412

Merged
merged 1 commit into from
Aug 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions lib/fog/storage/google_xml/requests/get_object_http_url.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ def get_object_http_url(bucket_name, object_name, expires, options = {})
raise ArgumentError.new("bucket_name is required") unless bucket_name
raise ArgumentError.new("object_name is required") unless object_name

https_url(options.merge(:headers => {},
:host => @host,
:method => "GET",
:path => "#{bucket_name}/#{object_name}"),
http_url(options.merge(:headers => {},
:host => @host,
:method => "GET",
:path => "#{bucket_name}/#{object_name}"),
expires)
http_url(url_options, expires)
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Fog
module Storage
class GoogleXML
module GetObjectHttpsUrl
def get_object_https_url(bucket_name, object_name, expires, options)
def get_object_https_url(bucket_name, object_name, expires, options = {})
raise ArgumentError.new("bucket_name is required") unless bucket_name
raise ArgumentError.new("object_name is required") unless object_name

Expand Down
16 changes: 16 additions & 0 deletions test/unit/storage/test_xml_requests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,22 @@ def teardown
Fog.unmock!
end

def test_get_http_url
url = @client.get_object_http_url("bucket",
"just some file.json",
Time.now + 2 * 60)
assert_match(/^http:\/\//, url,
"URL starts with HTTP")
end

def test_get_https_url
url = @client.get_object_https_url("bucket",
"just some file.json",
Time.now + 2 * 60)
assert_match(/^https:\/\//, url,
"URL starts with HTTPS")
end

def test_get_url_path_has_query_params
url = @client.get_object_url("bucket",
"just some file.json",
Expand Down