diff --git a/http/QueryParams.cs b/http/QueryParams.cs index f08ce18..e96a80e 100644 --- a/http/QueryParams.cs +++ b/http/QueryParams.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Text; using UnityEngine; +using UnityEngine.Networking; namespace RESTClient { public class QueryParams { @@ -26,8 +27,8 @@ public override string ToString() { } StringBuilder sb = new StringBuilder("?"); foreach (KeyValuePair param in parameters) { - string key = WWW.EscapeURL(param.Key); - string value = WWW.EscapeURL(param.Value); + string key = UnityWebRequest.EscapeURL(param.Key); + string value = UnityWebRequest.EscapeURL(param.Value); sb.Append(key + "=" + value + "&"); } sb.Remove(sb.Length - 1, 1); diff --git a/http/RestRequest.cs b/http/RestRequest.cs index d316e2b..f67ecf5 100644 --- a/http/RestRequest.cs +++ b/http/RestRequest.cs @@ -36,19 +36,14 @@ public void AddHeaders(Dictionary headers) { public void AddBody(string text, string contentType = "text/plain; charset=UTF-8") { byte[] bytes = Encoding.UTF8.GetBytes(text); - this.AddBody(bytes, contentType, false); + this.AddBody(bytes, contentType); } public void AddBody(byte[] bytes, string contentType) { - this.AddBody(bytes, contentType, false); - } - - public void AddBody(byte[] bytes, string contentType, bool isChunked) { if (Request.uploadHandler != null) { Debug.LogWarning("Request body can only be set once"); return; } - Request.chunkedTransfer = isChunked; Request.uploadHandler = new UploadHandlerRaw(bytes); Request.uploadHandler.contentType = contentType; } @@ -60,7 +55,7 @@ public void AddBody(byte[] bytes, string contentType, bool isChunked) { } string jsonString = JsonUtility.ToJson(data); byte[] bytes = Encoding.UTF8.GetBytes(jsonString); - this.AddBody(bytes, contentType, false); + this.AddBody(bytes, contentType); } public virtual void AddQueryParam(string key, string value, bool shouldUpdateRequestUrl = false) {