Skip to content

Commit 9283fe6

Browse files
authored
Merge pull request #412 from stanhu/sh-fix-broken-get-http-url
Fix broken calls to get_object_http_url
2 parents fa2e560 + 154bf89 commit 9283fe6

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

lib/fog/storage/google_xml/requests/get_object_http_url.rb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@ def get_object_http_url(bucket_name, object_name, expires, options = {})
66
raise ArgumentError.new("bucket_name is required") unless bucket_name
77
raise ArgumentError.new("object_name is required") unless object_name
88

9-
https_url(options.merge(:headers => {},
10-
:host => @host,
11-
:method => "GET",
12-
:path => "#{bucket_name}/#{object_name}"),
9+
http_url(options.merge(:headers => {},
10+
:host => @host,
11+
:method => "GET",
12+
:path => "#{bucket_name}/#{object_name}"),
1313
expires)
14-
http_url(url_options, expires)
1514
end
1615
end
1716

lib/fog/storage/google_xml/requests/get_object_https_url.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module Fog
22
module Storage
33
class GoogleXML
44
module GetObjectHttpsUrl
5-
def get_object_https_url(bucket_name, object_name, expires, options)
5+
def get_object_https_url(bucket_name, object_name, expires, options = {})
66
raise ArgumentError.new("bucket_name is required") unless bucket_name
77
raise ArgumentError.new("object_name is required") unless object_name
88

test/unit/storage/test_xml_requests.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,22 @@ def teardown
1212
Fog.unmock!
1313
end
1414

15+
def test_get_http_url
16+
url = @client.get_object_http_url("bucket",
17+
"just some file.json",
18+
Time.now + 2 * 60)
19+
assert_match(/^http:\/\//, url,
20+
"URL starts with HTTP")
21+
end
22+
23+
def test_get_https_url
24+
url = @client.get_object_https_url("bucket",
25+
"just some file.json",
26+
Time.now + 2 * 60)
27+
assert_match(/^https:\/\//, url,
28+
"URL starts with HTTPS")
29+
end
30+
1531
def test_get_url_path_has_query_params
1632
url = @client.get_object_url("bucket",
1733
"just some file.json",

0 commit comments

Comments
 (0)