Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrades RestSharp from v107.3.0 to v112.1.0 #231

Merged
merged 2 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>

Loading