Skip to content

Commit

Permalink
Merge pull request #231 from Mangopay/feature/update-restsharp-dep-v112
Browse files Browse the repository at this point in the history
Upgrades RestSharp from v107.3.0 to v112.1.0
  • Loading branch information
iulian03 authored Nov 11, 2024
2 parents c01359d + 75afc92 commit 1e4ed39
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion MangoPay.SDK.Tests/MangoPay.SDK.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Common.Logging" Version="3.4.1" />
<PackageReference Include="Common.Logging.Core" Version="3.4.1" />
<PackageReference Include="RestSharp" Version="107.3.0" />
<PackageReference Include="RestSharp" Version="112.1.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>
<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion MangoPay.SDK/Core/MangoPayJsonSerializer.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
using Newtonsoft.Json;
using RestSharp;
using RestSharp.Serializers;

namespace MangoPay.SDK.Core
{
public sealed class MangoPayJsonSerializer : ISerializer
{
public string ContentType { get; set; }
public ContentType ContentType { get; set; }

public string Serialize(object obj)
{
Expand Down
16 changes: 8 additions & 8 deletions MangoPay.SDK/Core/RestTool.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using Common.Logging;
using MangoPay.SDK.Entities;
using RestSharp;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using Common.Logging;
using MangoPay.SDK.Entities;
using RestSharp;

namespace MangoPay.SDK.Core
{
Expand All @@ -19,16 +19,16 @@ public class RestSharpDto

public RestClient Client { get; }

// options need timout in milliseconds
private RestSharpDto(string url, int timeout)
{
_options = new RestClientOptions(url)
{
ThrowOnAnyError = false,
Timeout = timeout
Timeout = new TimeSpan(timeout * 1000L)
};

Client = new RestClient(_options);
Client.UseSerializer<MangoPaySerializer>();
Client = new RestClient(_options, configureSerialization: s => s.UseSerializer(() => new MangoPaySerializer()));
}

public static RestSharpDto GetInstance(string url, int timeout)
Expand Down Expand Up @@ -140,7 +140,7 @@ private void CheckResponseCode(RestResponse restResponse)
if (restResponse.ResponseStatus == ResponseStatus.TimedOut)
throw new TimeoutException(restResponse.ErrorMessage);

if (restResponse.ErrorException is System.Net.ProtocolViolationException)
if (restResponse.ErrorException is ProtocolViolationException)
throw restResponse.ErrorException;

throw new ResponseException(restResponse.Content, responseCode);
Expand Down
2 changes: 1 addition & 1 deletion MangoPay.SDK/MangoPay.SDK.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Common.Logging" Version="3.4.1" />
<PackageReference Include="Common.Logging.Core" Version="3.4.1" />
<PackageReference Include="RestSharp" Version="107.3.0" />
<PackageReference Include="RestSharp" Version="112.1.0" />
</ItemGroup>
</Project>

0 comments on commit 1e4ed39

Please sign in to comment.