Exemple #1
0
        //Post Json
        public static UnityWebRequest PostJson(string uri, string jsonString, DownloadHandler downloader)
        {
            UnityWebRequest request = UWebRequestCreator.PostRequest(uri, jsonString, downloader);

            request.uploadHandler.contentType = "application/json; charset=utf-8";

            return(request);
        }
Exemple #2
0
        public static UnityWebRequest PostRequest(string uri, WWWForm formData, DownloadHandler downloader)
        {
            byte[]          data    = UWebRequestCreator.FormDataToByte(formData);
            UnityWebRequest request = UWebRequestCreator.PostRequest(uri, data, downloader);

            //set request headers
            if (formData != null)
            {
                UWebRequestCreator.SetupRequestHeaders(request, formData.headers);
            }

            return(request);
        }
Exemple #3
0
        public static UnityWebRequest PostRequest(string uri, string postData, DownloadHandler downloader)
        {
            //string to byte[]
            byte[] data = null;
            if (!string.IsNullOrEmpty(postData))
            {
                //
                data = System.Text.Encoding.UTF8.GetBytes(postData);
            }

            UnityWebRequest request = UWebRequestCreator.PostRequest(uri, data, downloader);

            return(request);
        }
Exemple #4
0
 /*------------------------------------------------------------------*/
 #region Get Request
 //Create Get Request
 public static UnityWebRequest GetRequest(string uri)
 {
     return(UWebRequestCreator.GetRequest(uri, new DownloadHandlerBuffer()));
 }