Пример #1
0
 public void Restful(ERestful method, string action , WWWForm form)
 {
     HttpWebRequestEntity request = new HttpWebRequestEntity(url + action, method);
     request.SetBody(form.data).SetContentType("application/x-www-form-urlencoded");
     queue.Enqueue(request);
 }
Пример #2
0
 public void Restful(ERestful method , string action , byte[] body)
 {
     HttpWebRequestEntity request = new HttpWebRequestEntity(url + action, method);
     request.SetBody(body).SetContentType("application/octet-stream");
     queue.Enqueue(request);
 }
Пример #3
0
 public void Restful(ERestful method, string action, byte[] body)
 {
     UnityWebRequest request = null;
     switch (method)
     {
         case ERestful.GET: request = UnityWebRequest.Get(url + action); break;
         case ERestful.PUT: request = UnityWebRequest.Put(url + action, body); break;
         case ERestful.DELETE: request = UnityWebRequest.Delete(url + action); break;
         case ERestful.HEAD: request = UnityWebRequest.Head(url + action); break;
         default: throw new Exception("this component is not support [" + method.ToString() + "] restful");
     }
     queue.Enqueue(request);
 }
Пример #4
0
 public void Restful(ERestful method, string action)
 {
     HttpWebRequestEntity request = new HttpWebRequestEntity(url + action , method);
     queue.Enqueue(request);
 }
Пример #5
0
 public void Restful(ERestful method, string action, WWWForm form)
 {
     if(method == ERestful.POST)
     {
         UnityWebRequest request = UnityWebRequest.Post(url + action, form);
         queue.Enqueue(request);
     }
     else
     {
         Restful(method, action, form.data);
     }
 }
Пример #6
0
 public void Restful(ERestful method, string action)
 {
     UnityWebRequest request = new UnityWebRequest(url + action, method.ToString());
     queue.Enqueue(request);
 }
Пример #7
0
 public HttpWebRequestEntity SetMethod(ERestful method)
 {
     this.method = method;
     return this;
 }
Пример #8
0
 public HttpWebRequestEntity(string uri, ERestful method)
 {
     this.uri = uri;
     this.method = method;
 }
Пример #9
0
 public HttpWebRequestEntity(string uri)
 {
     this.uri = uri;
     method = ERestful.GET;
 }