示例#1
0
 public static async Task <string> GetAsync(string url, int timeout = 20000)
 {
     HttpHelper.HttpRequestArgs obj = new HttpHelper.HttpRequestArgs();
     obj.Url     = url;
     obj.Timeout = timeout;
     return(await TaskHelper.Start <object, string>(delegate(object o)
     {
         HttpHelper.HttpRequestArgs httpRequestArgs = o as HttpHelper.HttpRequestArgs;
         return HttpHelper.Get(httpRequestArgs.Url, httpRequestArgs.Timeout);
     }, obj));
 }
示例#2
0
 public static async Task <string> PostAsync(string url, string content, int timeout = 20000, string contentType = "application/json")
 {
     HttpHelper.HttpRequestArgs obj = new HttpHelper.HttpRequestArgs();
     obj.Url         = url;
     obj.Content     = content;
     obj.Timeout     = timeout;
     obj.ContentType = contentType;
     return(await TaskHelper.Start <object, string>(delegate(object o)
     {
         HttpHelper.HttpRequestArgs httpRequestArgs = o as HttpHelper.HttpRequestArgs;
         return HttpHelper.Post(httpRequestArgs.Url, httpRequestArgs.Content, httpRequestArgs.Timeout, httpRequestArgs.ContentType);
     }, obj));
 }