From 28f93504cce3d25474e8ade7335a7ddecca90aa7 Mon Sep 17 00:00:00 2001 From: Wojciech PIETRZAK Date: Fri, 8 Jul 2022 13:06:33 +0200 Subject: [PATCH] Use ApiClient basePath in API calls --- .../Client/ApiClient.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/cybersource-rest-client-netstandard/cybersource-rest-client-netstandard/Client/ApiClient.cs b/cybersource-rest-client-netstandard/cybersource-rest-client-netstandard/Client/ApiClient.cs index d1787ceb..0516d7d1 100644 --- a/cybersource-rest-client-netstandard/cybersource-rest-client-netstandard/Client/ApiClient.cs +++ b/cybersource-rest-client-netstandard/cybersource-rest-client-netstandard/Client/ApiClient.cs @@ -193,7 +193,14 @@ private RestRequest PrepareRequest( ParameterType.HttpHeader); } else + { + if (request.Parameters.Any(x => x.Name == param.Key && x.Type == ParameterType.HttpHeader)) + { + continue; + } + request.AddHeader(param.Key, param.Value); + } } // add query parameter, if any @@ -957,12 +964,6 @@ public void CallAuthenticationHeaders(string requestType, string requestTarget, //Set the Configuration Configuration.DefaultHeader = authenticationHeaders; - RestClient = new RestClient("https://" + merchantConfig.HostName); - - if (Configuration.Proxy != null) - { - RestClient.Proxy = Configuration.Proxy; - } } } }