Skip to content

Commit 8351144

Browse files
rest sharp version upgrade
1 parent 89dae33 commit 8351144

File tree

5 files changed

+42
-40
lines changed

5 files changed

+42
-40
lines changed

Client/ApiClient.cs

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -270,15 +270,18 @@ private RestRequest PrepareRestRequest(
270270
}
271271

272272
RestRequest requestT = new RestRequest(path);
273-
RestClientOptions clientOptions = RestClient.Options;
273+
RestClientOptions clientOptions = new RestClientOptions(RestClient.Options.BaseUrl)
274+
{
275+
Timeout = TimeSpan.FromMilliseconds(Configuration.Timeout),
276+
};
274277

275278
if (Configuration.Proxy != null)
276279
{
277280
clientOptions.Proxy = Configuration.Proxy;
278281
}
282+
clientOptions.UserAgent = Configuration.UserAgent;
279283

280284
RestClient = new RestClient(clientOptions);
281-
RestClient.Options.UserAgent = Configuration.UserAgent;
282285

283286
// Add Header Parameter, if any
284287
// Passed to this function
@@ -444,9 +447,10 @@ public object CallApi(
444447
pathParams, contentType);
445448

446449
// set timeout
447-
request.Timeout = Configuration.Timeout;
448-
RestClientOptions clientOptions = RestClient.Options;
449-
450+
RestClientOptions clientOptions = new RestClientOptions(RestClient.Options.BaseUrl)
451+
{
452+
Timeout = TimeSpan.FromMilliseconds(Configuration.Timeout),
453+
};
450454
// RestClient.ClearHandlers();
451455

452456
if (Configuration.Proxy != null)
@@ -471,9 +475,9 @@ public object CallApi(
471475
clientCertPassword.Dispose();
472476
clientOptions.ClientCertificates = new X509CertificateCollection { certificate };
473477
}
478+
clientOptions.UserAgent = Configuration.UserAgent;
474479

475480
RestClient = new RestClient(clientOptions);
476-
RestClient.Options.UserAgent = Configuration.UserAgent;
477481

478482
// Logging Request Headers
479483
var headerPrintOutput = new StringBuilder();
@@ -572,10 +576,11 @@ public async System.Threading.Tasks.Task<object> CallApiAsync(
572576
}
573577
}
574578

575-
// set timeout
576-
request.Timeout = Configuration.Timeout;
577579
// set user agent
578-
RestClientOptions clientOptions = RestClient.Options;
580+
RestClientOptions clientOptions = new RestClientOptions(RestClient.Options.BaseUrl)
581+
{
582+
Timeout = TimeSpan.FromMilliseconds(Configuration.Timeout)
583+
};
579584

580585
if (logUtility.IsMaskingEnabled(logger))
581586
{
@@ -585,9 +590,8 @@ public async System.Threading.Tasks.Task<object> CallApiAsync(
585590
{
586591
logger.Debug($"HTTP Request Headers :\n{headerPrintOutput.ToString()}");
587592
}
588-
593+
clientOptions.UserAgent = Configuration.UserAgent;
589594
RestClient = new RestClient(clientOptions);
590-
RestClient.Options.UserAgent = Configuration.UserAgent;
591595

592596
InterceptRequest(request);
593597
var response = await RestClient.ExecuteAsync(request);
@@ -999,7 +1003,11 @@ public void CallAuthenticationHeaders(string requestType, string requestTarget,
9991003
RestClient = new RestClient("https://" + merchantConfig.HostName);
10001004
}
10011005

1002-
RestClientOptions clientOptions = RestClient.Options;
1006+
RestClientOptions clientOptions = new RestClientOptions(RestClient.Options.BaseUrl)
1007+
{
1008+
Proxy = RestClient.Options.Proxy,
1009+
UserAgent = RestClient.Options.UserAgent,
1010+
};
10031011
if (Configuration.Proxy != null)
10041012
{
10051013
clientOptions.Proxy = Configuration.Proxy;

Client/Configuration.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,7 @@ public Configuration(ApiClient apiClient)
148148
/// <value>Timeout.</value>
149149
public int Timeout
150150
{
151-
get { return ApiClient.RestClient.Options.MaxTimeout; }
152-
153-
set
154-
{
155-
if (ApiClient != null)
156-
ApiClient.RestClient.Options.MaxTimeout = value;
157-
}
151+
get; set;
158152
}
159153

160154
/// <summary>

cybersource-rest-client-dotnet.csproj

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,39 +38,39 @@ OpenAPI spec version: 0.0.1
3838
<WarningLevel>4</WarningLevel>
3939
</PropertyGroup>
4040
<ItemGroup>
41-
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
42-
<HintPath>packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
41+
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
42+
<HintPath>packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\netstandard2.0\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
4343
</Reference>
4444
<Reference Include="Newtonsoft.Json">
4545
<HintPath>packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
4646
</Reference>
47-
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
47+
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
4848
<SpecificVersion>False</SpecificVersion>
4949
<HintPath>packages\NLog.5.0.0\lib\net46\NLog.dll</HintPath>
5050
</Reference>
51-
<Reference Include="RestSharp, Version=108.0.3.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
52-
<HintPath>packages\RestSharp.108.0.3\lib\netstandard2.0\RestSharp.dll</HintPath>
51+
<Reference Include="RestSharp, Version=112.1.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
52+
<HintPath>packages\RestSharp.112.1.0\lib\netstandard2.0\RestSharp.dll</HintPath>
5353
</Reference>
5454
<Reference Include="System" />
5555
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
5656
<HintPath>packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
5757
</Reference>
5858
<Reference Include="System.Core" />
59-
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
60-
<HintPath>packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
59+
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
60+
<HintPath>packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
6161
</Reference>
6262
<Reference Include="System.Numerics" />
6363
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
6464
<HintPath>packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
6565
</Reference>
66-
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
67-
<HintPath>packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
66+
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
67+
<HintPath>packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
6868
</Reference>
69-
<Reference Include="System.Text.Encodings.Web, Version=5.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
70-
<HintPath>packages\System.Text.Encodings.Web.5.0.1\lib\net461\System.Text.Encodings.Web.dll</HintPath>
69+
<Reference Include="System.Text.Encodings.Web, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
70+
<HintPath>packages\System.Text.Encodings.Web.8.0.0\lib\netstandard2.0\System.Text.Encodings.Web.dll</HintPath>
7171
</Reference>
72-
<Reference Include="System.Text.Json, Version=5.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
73-
<HintPath>packages\System.Text.Json.5.0.1\lib\net461\System.Text.Json.dll</HintPath>
72+
<Reference Include="System.Text.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
73+
<HintPath>packages\System.Text.Json.8.0.4\lib\netstandard2.0\System.Text.Json.dll</HintPath>
7474
</Reference>
7575
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
7676
<HintPath>packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
@@ -102,4 +102,4 @@ OpenAPI spec version: 0.0.1
102102
<Content Include="license.txt" />
103103
</ItemGroup>
104104
<Import Project="$(MsBuildToolsPath)\Microsoft.CSharp.targets" />
105-
</Project>
105+
</Project>

cybersource-rest-client-dotnet.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<releaseNotes>Minor Release.</releaseNotes>
1313
<dependencies>
1414
<dependency id="Newtonsoft.Json" version="13.0.3"></dependency>
15-
<dependency id="RestSharp" version="[108.0.3]"></dependency>
15+
<dependency id="RestSharp" version="[112.1.0]"></dependency>
1616
<dependency id="NLog" version="5.0.0"></dependency>
1717
<dependency id="CyberSource.Authentication" version="[0.0.0.20]"></dependency>
1818
</dependencies>

packages.config

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
33
<package id="CyberSource.Authentication" version="0.0.0.20" targetFramework="net461" />
4-
<package id="Microsoft.Bcl.AsyncInterfaces" version="5.0.0" targetFramework="net461" />
4+
<package id="Microsoft.Bcl.AsyncInterfaces" version="8.0.0" targetFramework="net461" />
55
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net461" />
66
<package id="NLog" version="5.0.0" targetFramework="net461" />
7-
<package id="RestSharp" version="108.0.3" targetFramework="net461" />
7+
<package id="RestSharp" version="112.1.0" targetFramework="net461" />
88
<package id="System.Buffers" version="4.5.1" targetFramework="net461" />
9-
<package id="System.Memory" version="4.5.4" targetFramework="net461" />
9+
<package id="System.Memory" version="4.5.5" targetFramework="net461" />
1010
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net461" />
11-
<package id="System.Runtime.CompilerServices.Unsafe" version="5.0.0" targetFramework="net461" />
12-
<package id="System.Text.Encodings.Web" version="5.0.1" targetFramework="net461" />
13-
<package id="System.Text.Json" version="5.0.1" targetFramework="net461" />
11+
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net461" />
12+
<package id="System.Text.Encodings.Web" version="8.0.0" targetFramework="net461" />
13+
<package id="System.Text.Json" version="8.0.4" targetFramework="net461" />
1414
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net461" />
1515
<package id="System.ValueTuple" version="4.5.0" targetFramework="net461" />
1616
</packages>

0 commit comments

Comments
 (0)