diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-06-29 01:54:49 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-06-29 01:54:49 -0400 |
commit | 86428a31c2c275b32f08f149157f2fad78c8e488 (patch) | |
tree | 55cc5c1084ea9173ff733a8a450ad336bea4709c /src | |
parent | c0370c54113bc95919affcbfbba8720a42b97a30 (diff) | |
download | SMAPI-86428a31c2c275b32f08f149157f2fad78c8e488.tar.gz SMAPI-86428a31c2c275b32f08f149157f2fad78c8e488.tar.bz2 SMAPI-86428a31c2c275b32f08f149157f2fad78c8e488.zip |
fix web API client not using correct JSON settings (#532)
Diffstat (limited to 'src')
-rw-r--r-- | src/StardewModdingAPI.Toolkit/Framework/Clients/WebApi/WebApiClient.cs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/StardewModdingAPI.Toolkit/Framework/Clients/WebApi/WebApiClient.cs b/src/StardewModdingAPI.Toolkit/Framework/Clients/WebApi/WebApiClient.cs index 5bbe473e..0ecd9664 100644 --- a/src/StardewModdingAPI.Toolkit/Framework/Clients/WebApi/WebApiClient.cs +++ b/src/StardewModdingAPI.Toolkit/Framework/Clients/WebApi/WebApiClient.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Net; using Newtonsoft.Json; +using StardewModdingAPI.Toolkit.Serialisation; namespace StardewModdingAPI.Toolkit.Framework.Clients.WebApi { @@ -18,6 +19,9 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.WebApi /// <summary>The API version number.</summary> private readonly ISemanticVersion Version; + /// <summary>The JSON serializer settings to use.</summary> + private readonly JsonSerializerSettings JsonSettings = new JsonHelper().JsonSettings; + /********* ** Public methods @@ -62,7 +66,7 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.WebApi client.Headers["Content-Type"] = "application/json"; client.Headers["User-Agent"] = $"SMAPI/{this.Version}"; string response = client.UploadString(fullUrl, data); - return JsonConvert.DeserializeObject<TResult>(response); + return JsonConvert.DeserializeObject<TResult>(response, this.JsonSettings); } } } |