Skip to content

Commit 2c84d42

Browse files
authored
Merge pull request #380 from J-W-Chan/main
fixed issue #372
2 parents e79644a + 7e9d34c commit 2c84d42

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Source/FikaAmazonAPI/FikaAmazonAPI.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
4141
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
4242
<PackageReference Include="RestSharp" Version="108.0.2" />
43+
<PackageReference Include="RestSharp.Serializers.NewtonsoftJson" Version="108.0.2" />
4344
<PackageReference Include="System.Collections" Version="4.3.0" />
4445
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
4546
<PackageReference Include="System.Reflection" Version="4.3.0" />

Source/FikaAmazonAPI/Services/RequestService.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
using System.Linq;
1414
using System.Net;
1515
using System.Threading.Tasks;
16+
using Newtonsoft.Json.Serialization;
17+
using RestSharp.Serializers.NewtonsoftJson;
1618
using static FikaAmazonAPI.AmazonSpApiSDK.Models.Token.CacheTokenData;
1719
using static FikaAmazonAPI.Utils.Constants;
1820

@@ -55,6 +57,7 @@ public RequestService(AmazonCredential amazonCredential)
5557
private void CreateRequest(string url, RestSharp.Method method)
5658
{
5759
RequestClient = new RestClient(ApiBaseUrl);
60+
RequestClient.UseNewtonsoftJson();
5861
Request = new RestRequest(url, method);
5962
}
6063
protected async Task CreateUnAuthorizedRequestAsync(string url, RestSharp.Method method, List<KeyValuePair<string, string>> queryParameters = null, object postJsonObj = null)
@@ -105,8 +108,8 @@ protected void CreateAuthorizedPagedRequest(AmazonFilter filter, string url, Res
105108
RestHeader();
106109
AddAccessToken();
107110
AddShippingBusinessId();
111+
108112
Request = await TokenGeneration.SignWithSTSKeysAndSecurityTokenAsync(Request, RequestClient.Options.BaseUrl.Host, AmazonCredential);
109-
110113
var response = await RequestClient.ExecuteAsync<T>(Request);
111114
SaveLastRequestHeader(response.Headers);
112115
SleepForRateLimit(response.Headers, rateLimitType);

0 commit comments

Comments
 (0)