Skip to content

Commit

Permalink
Ruby Client for Faraday: fix file downloading (#17333)
Browse files Browse the repository at this point in the history
* Ruby Client for Faraday: fix file downloading

In MR #16876, a bug was introduced that causes file downloading to fail
for the Faraday adapter.

This commit fixes the obvious missing parameter for the method
call to download_file() and the missing variable `request` for saving the
response value of the call to build_request().

Signed-off-by: Daniel Schnell <[email protected]>

* Add automatically generated changes.

---------

Signed-off-by: Daniel Schnell <[email protected]>
  • Loading branch information
lumpidu committed Dec 9, 2023
1 parent 351f764 commit 5831848
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
stream = nil
begin
response = connection(opts).public_send(http_method.to_sym.downcase) do |req|
build_request(http_method, path, req, opts)
request = build_request(http_method, path, req, opts)
stream = download_file(request) if opts[:return_type] == 'File' || opts[:return_type] == 'Binary'
end

Expand All @@ -33,7 +33,7 @@
end

if opts[:return_type] == 'File' || opts[:return_type] == 'Binary'
data = deserialize_file(stream)
data = deserialize_file(response, stream)
elsif opts[:return_type]
data = deserialize(response, opts[:return_type])
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def call_api(http_method, path, opts = {})
stream = nil
begin
response = connection(opts).public_send(http_method.to_sym.downcase) do |req|
build_request(http_method, path, req, opts)
request = build_request(http_method, path, req, opts)
stream = download_file(request) if opts[:return_type] == 'File' || opts[:return_type] == 'Binary'
end

Expand All @@ -79,7 +79,7 @@ def call_api(http_method, path, opts = {})
end

if opts[:return_type] == 'File' || opts[:return_type] == 'Binary'
data = deserialize_file(stream)
data = deserialize_file(response, stream)
elsif opts[:return_type]
data = deserialize(response, opts[:return_type])
else
Expand Down

0 comments on commit 5831848

Please sign in to comment.