From a258cf3fc6e8a04280fd89ad07a7223048d53fca Mon Sep 17 00:00:00 2001 From: David van Laatum Date: Fri, 3 Aug 2018 01:32:09 +0930 Subject: [PATCH] #714 prevent throwing another exception if the request fails eg connection reset (#715) * prevent throwing another exception if the request fails eg connection reset * prevent throwing another exception if the request fails eg connection reset --- .../src/main/resources/ruby-client/api_client.mustache | 2 +- samples/client/petstore/ruby/lib/petstore/api_client.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/ruby-client/api_client.mustache b/modules/openapi-generator/src/main/resources/ruby-client/api_client.mustache index 33feac7acdf..31ed22373a5 100644 --- a/modules/openapi-generator/src/main/resources/ruby-client/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/ruby-client/api_client.mustache @@ -238,7 +238,7 @@ module {{moduleName}} tempfile.write(chunk) end request.on_complete do |response| - tempfile.close + 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 "\ diff --git a/samples/client/petstore/ruby/lib/petstore/api_client.rb b/samples/client/petstore/ruby/lib/petstore/api_client.rb index 93022030996..42dbf2d7228 100644 --- a/samples/client/petstore/ruby/lib/petstore/api_client.rb +++ b/samples/client/petstore/ruby/lib/petstore/api_client.rb @@ -244,7 +244,7 @@ module Petstore tempfile.write(chunk) end request.on_complete do |response| - tempfile.close + 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 "\