@@ -56,6 +56,7 @@ def call_api(http_method, path, opts = {})
5656 }
5757
5858 connection = Faraday . new ( :url => config . base_url , :ssl => ssl_options ) do |conn |
59+ conn . proxy = config . proxy if config . proxy
5960 conn . request ( :basic_auth , config . username , config . password )
6061 @config . configure_middleware ( conn )
6162 if opts [ :header_params ] [ "Content-Type" ] == "multipart/form-data"
@@ -106,7 +107,7 @@ def call_api(http_method, path, opts = {})
106107 # @option opts [Hash] :query_params Query parameters
107108 # @option opts [Hash] :form_params Query parameters
108109 # @option opts [Object] :body HTTP body (JSON/XML)
109- # @return [Typhoeus ::Request] A Typhoeus Request
110+ # @return [Faraday ::Request] A Faraday Request
110111 def build_request ( http_method , path , request , opts = { } )
111112 url = build_request_url ( path , opts )
112113 http_method = http_method . to_sym . downcase
@@ -117,12 +118,6 @@ def build_request(http_method, path, request, opts = {})
117118
118119 update_params_for_auth! header_params , query_params , opts [ :auth_names ]
119120
120- req_opts = {
121- :params_encoding => @config . params_encoding ,
122- :timeout => @config . timeout ,
123- :verbose => @config . debugging
124- }
125-
126121 if [ :post , :patch , :put , :delete ] . include? ( http_method )
127122 req_body = build_request_body ( header_params , form_params , opts [ :body ] )
128123 if @config . debugging
@@ -131,7 +126,12 @@ def build_request(http_method, path, request, opts = {})
131126 end
132127 request . headers = header_params
133128 request . body = req_body
134- request . options = OpenStruct . new ( req_opts )
129+
130+ # Overload default options only if provided
131+ request . options . params_encoding = @config . params_encoding if @config . params_encoding
132+ request . options . timeout = @config . timeout if @config . timeout
133+ request . options . verbose = @config . debugging if @config . debugging
134+
135135 request . url url
136136 request . params = query_params
137137 download_file ( request ) if opts [ :return_type ] == 'File'
0 commit comments