public IEnumerator GetSecured(string url, GetSecuredCallback callback) { Dictionary <string, string> headers = new Dictionary <string, string>(); headers.Add("_csrf", _csrf); headers.Add("Cookie", "XSRF-TOKEN=" + _csrf + ";JSESSIONID=" + sessionId); headers.Add("X-XSRF-TOKEN", _csrf); WWW cases = new WWW(url, null, headers); yield return(cases); string json = cases.text; callback(json); }
public IEnumerator PostJsonSecured(string url, object obj, GetSecuredCallback callback) { string json = JsonConvert.SerializeObject(obj); Debug.Log("send: " + json); byte[] postData = System.Text.Encoding.UTF8.GetBytes(json); Dictionary <string, string> headers = new Dictionary <string, string>(); headers.Add("_csrf", _csrf); headers.Add("Cookie", "XSRF-TOKEN=" + _csrf + ";JSESSIONID=" + sessionId); headers.Add("X-XSRF-TOKEN", _csrf); headers.Add("Content-Type", "application/json"); WWW cases = new WWW(url, postData, headers); yield return(cases); json = cases.text; callback(json); }