[BUG] [Ruby] client raises error on file download
Created by: tpltn
Description
Hey! There is a method def download_file(request)
, which should write a message to the log when request completes with tempfile path. But if request fails, there are no tempfile:
def download_file(request)
# ...
request.on_complete do |response|
tempfile.close if tempfile
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
"explicitly with `tempfile.delete`"
end
end
openapi-generator version
latest master 94152c4d
Steps to reproduce
- Generate Ruby (Typhoeus or Faraday, doesn't matter) client
- Make API, which returns error or which is unavailable
- Try to download file with generated client
Suggest a fix/enhancement
Write a log message if tempfile exists. I'll make PR in a moment