[Ruby][Faraday][#10137] Fix config request options and timeout (#10405)

* Update default timeout of Faraday request to 60 seconds

* Fix request options of Ruby Faraday client
This commit is contained in:
NivathaSV8
2021-10-02 14:05:41 +09:00
committed by GitHub
parent 68285bcd0a
commit 0eb7189fae
4 changed files with 5 additions and 10 deletions

View File

@@ -73,9 +73,6 @@
update_params_for_auth! header_params, query_params, opts[:auth_names]
req_opts = {
:method => http_method,
:headers => header_params,
:params => query_params,
:params_encoding => @config.params_encoding,
:timeout => @config.timeout,
:verbose => @config.debugging
@@ -83,13 +80,13 @@
if [:post, :patch, :put, :delete].include?(http_method)
req_body = build_request_body(header_params, form_params, opts[:body])
req_opts.update :body => req_body
if @config.debugging
@config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n"
end
end
request.headers = header_params
request.body = req_body
request.options = OpenStruct.new(req_opts)
request.url url
request.params = query_params
download_file(request) if opts[:return_type] == 'File'

View File

@@ -110,7 +110,6 @@ module {{moduleName}}
@server_operation_variables = {}
@api_key = {}
@api_key_prefix = {}
@timeout = 0
@client_side_validation = true
{{#isFaraday}}
@ssl_verify = true
@@ -118,6 +117,7 @@ module {{moduleName}}
@ssl_ca_file = nil
@ssl_client_cert = nil
@ssl_client_key = nil
@timeout = 60
{{/isFaraday}}
{{^isFaraday}}
@verify_ssl = true
@@ -125,6 +125,7 @@ module {{moduleName}}
@params_encoding = nil
@cert_file = nil
@key_file = nil
@timeout = 0
{{/isFaraday}}
@debugging = false
@inject_format = false

View File

@@ -117,9 +117,6 @@ module Petstore
update_params_for_auth! header_params, query_params, opts[:auth_names]
req_opts = {
:method => http_method,
:headers => header_params,
:params => query_params,
:params_encoding => @config.params_encoding,
:timeout => @config.timeout,
:verbose => @config.debugging
@@ -127,13 +124,13 @@ module Petstore
if [:post, :patch, :put, :delete].include?(http_method)
req_body = build_request_body(header_params, form_params, opts[:body])
req_opts.update :body => req_body
if @config.debugging
@config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n"
end
end
request.headers = header_params
request.body = req_body
request.options = OpenStruct.new(req_opts)
request.url url
request.params = query_params
download_file(request) if opts[:return_type] == 'File'

View File

@@ -142,13 +142,13 @@ module Petstore
@server_operation_variables = {}
@api_key = {}
@api_key_prefix = {}
@timeout = 0
@client_side_validation = true
@ssl_verify = true
@ssl_verify_mode = nil
@ssl_ca_file = nil
@ssl_client_cert = nil
@ssl_client_key = nil
@timeout = 60
@debugging = false
@inject_format = false
@force_ending_format = false