Skip to content

Commit

Permalink
com.utilities.rest 2.5.4 (#70)
Browse files Browse the repository at this point in the history
- Fixed parsing json in request and body responses
  • Loading branch information
StephenHodgson authored Feb 29, 2024
1 parent 3aeae6c commit 558830f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public abstract class BaseEndPoint<TClient, TAuthentication, TSettings>
/// <summary>
/// <see cref="IClient"/> for this endpoint.
/// </summary>
/// ReSharper disable once InconsistentNaming
protected readonly TClient client;

/// <summary>
Expand All @@ -39,7 +40,7 @@ public abstract class BaseEndPoint<TClient, TAuthentication, TSettings>
/// </summary>
/// <param name="endpoint">The endpoint url.</param>
/// <param name="queryParameters">Optional, parameters to add to the endpoint.</param>
protected string GetUrl(string endpoint = "", Dictionary<string, string> queryParameters = null)
protected virtual string GetUrl(string endpoint = "", Dictionary<string, string> queryParameters = null)
{
var result = string.Format(client.Settings.BaseRequestUrlFormat, $"{Root}{endpoint}");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public string ToString(string methodName)
{
try
{
debugMessageObject["request"]["body"] = JObject.Parse(RequestBody);
debugMessageObject["request"]["body"] = JToken.Parse(RequestBody);
}
catch
{
Expand All @@ -144,7 +144,7 @@ public string ToString(string methodName)

debugMessageObject["response"] = new()
{
["code"] = Code,
["code"] = Code
};

if (Headers != null)
Expand All @@ -171,7 +171,7 @@ public string ToString(string methodName)

try
{
((JArray)debugMessageObject["response"]["body"]).Add(JObject.Parse(part));
((JArray)debugMessageObject["response"]["body"]).Add(JToken.Parse(part));
}
catch
{
Expand All @@ -183,7 +183,7 @@ public string ToString(string methodName)
{
try
{
debugMessageObject["response"]["body"] = JObject.Parse(Body);
debugMessageObject["response"]["body"] = JToken.Parse(Body);
}
catch
{
Expand Down
2 changes: 1 addition & 1 deletion Utilities.Rest/Packages/com.utilities.rest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "Utilities.Rest",
"description": "This package contains useful RESTful utilities for the Unity Game Engine.",
"keywords": [],
"version": "2.5.3",
"version": "2.5.4",
"unity": "2021.3",
"documentationUrl": "https://github.com/RageAgainstThePixel/com.utilities.rest#documentation",
"changelogUrl": "https://github.com/RageAgainstThePixel/com.utilities.rest/releases",
Expand Down

0 comments on commit 558830f

Please sign in to comment.