@@ -31,7 +31,6 @@ module {{moduleName}}
3131 @config = config
3232 @user_agent = "{ {#httpUserAgent} }{ {{.} }}{ {/httpUserAgent} }{ {^httpUserAgent} }Swagger-Codegen/#{ VERSION} /ruby{ {/httpUserAgent} }"
3333 @default_headers = {
34- ' Content-Type' => ' application/json' ,
3534 ' User-Agent' => @user_agent
3635 }
3736
@@ -107,9 +106,13 @@ module {{moduleName}}
107106 if !query_params.empty?
108107 query_params = Addressable::URI.form_encode(query_params)
109108 end
110- headers = CallAuthenticationHeader(http_method, path, body_params, opts[:header_params], query_params)
109+
110+ headers = opts[:header_params]
111+ if $merchantconfig_obj.authenticationType.upcase != Constants::AUTH_TYPE_MUTUAL_AUTH
112+ headers = CallAuthenticationHeader(http_method, path, body_params, headers, query_params)
113+ end
111114 http_method = http_method.to_sym.downcase
112- header_params = @default_headers .merge(headers || { } )
115+ header_params = headers .merge(@default_headers )
113116 form_params = opts[:form_params] || { }
114117
115118 { {#hasAuthMethods} }
@@ -119,6 +122,12 @@ module {{moduleName}}
119122 # set ssl_verifyhosts option based on @config.verify_ssl_host (true/false)
120123 _verify_ssl_host = @config.verify_ssl_host ? 2 : 0
121124
125+ # client cert
126+ if $merchantconfig_obj.enableClientCert
127+ @config.cert_file = File.join($merchantconfig_obj.clientCertDirectory, $merchantconfig_obj.sslClientCert)
128+ @config.key_file = File.join($merchantconfig_obj.clientCertDirectory, $merchantconfig_obj.privateKey)
129+ end
130+
122131 req_opts = {
123132 :method => http_method,
124133 :headers => header_params,
@@ -128,6 +137,7 @@ module {{moduleName}}
128137 :ssl_verifypeer => @config.verify_ssl,
129138 :ssl_verifyhost => _verify_ssl_host,
130139 :sslcert => @config.cert_file,
140+ :sslkeypasswd => $merchantconfig_obj .sslKeyPassword || " " ,
131141 :sslkey => @config.key_file,
132142 :verbose => @config.debugging
133143 }
@@ -203,6 +213,10 @@ module {{moduleName}}
203213 token = "Bearer " + token
204214 header_params['Authorization'] = token
205215 end
216+ if $merchantconfig_obj.authenticationType.upcase == Constants::AUTH_TYPE_OAUTH
217+ token = "Bearer " + token
218+ header_params['Authorization'] = token
219+ end
206220 header_params.each do |key, value|
207221 log_obj.logger.info("#{ key} : #{ value} ")
208222 end
@@ -377,6 +391,15 @@ module {{moduleName}}
377391 data[key] = value.to_s
378392 end
379393 end
394+ JSON.parse(body).each do |key, value|
395+ case value
396+ when ::File, ::Array, nil
397+ # let typhoeus handle File, Array and nil parameters
398+ data[key] = value
399+ else
400+ data[key] = value.to_s
401+ end
402+ end
380403 elsif body
381404 data = body.is_a?(String) ? body : body.to_json
382405 else
0 commit comments