Esempio n. 1
0
        public virtual IEnumerator Post(string url, byte[] encodedData, Dictionary <string, string> headers, Action <RESTResponse> listener)
        {
            if (!Application.isEditor)
            {
                headers = AddMetricsHeader(headers);
            }
            long start = SwrveHelper.GetMilliseconds();

            using (var www = CrossPlatformUtils.MakeRequest(url, UnityWebRequest.kHttpVerbPOST, encodedData, headers)) {
                yield return(www.SendWebRequest());

                long wwwTime = SwrveHelper.GetMilliseconds() - start;
                ProcessResponse(www, wwwTime, url, listener);
            }
        }
Esempio n. 2
0
        public virtual IEnumerator Get(string url, Action <RESTResponse> listener)
        {
            Dictionary <string, string> headers = new Dictionary <string, string>();

            if (!Application.isEditor)
            {
                headers = AddMetricsHeader(headers);
            }
            long start = SwrveHelper.GetMilliseconds();

            using (UnityWebRequest www = CrossPlatformUtils.MakeRequest(url, "GET", null, headers))
            {
                yield return(www.SendWebRequest());

                long wwwTime = SwrveHelper.GetMilliseconds() - start;
                ProcessResponse(www, wwwTime, url, listener);
            }
        }