Skip to content

Commit

Permalink
Add body abstract type checks for string
Browse files Browse the repository at this point in the history
  • Loading branch information
David Douglas committed Nov 8, 2017
1 parent 68a568e commit 31236dc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions http/ZumoRequest.cs
Expand Up @@ -42,6 +42,10 @@ public sealed class ZumoRequest : RestRequest {
}

public override void AddBody<T>(T data, string contentType = "application/json; charset=utf-8") {
if (typeof(T) == typeof(string)) {
this.AddBody(data.ToString(), contentType);
return;
}
string jsonString = excludeSystemProperties ? JsonHelper.ToJsonExcludingSystemProperties(data) : JsonUtility.ToJson(data);
byte[] bytes = Encoding.UTF8.GetBytes(jsonString);
this.AddBody(bytes, contentType);
Expand Down

0 comments on commit 31236dc

Please sign in to comment.