Ejemplo n.º 1
0
        public static TResult Send <TResult>(this HttpWebRequest httpWebRequest)
        {
            var response = httpWebRequest.Send();

            response.EnsureSuccess();
            return(response.Content <TResult>());
        }
Ejemplo n.º 2
0
 public static void Delete(this HttpWebRequest httpWebRequest)
 {
     httpWebRequest.Method = HttpMethod.DELETE;
     using (var response = httpWebRequest.Send())
     {
         response.EnsureSuccess();
     }
 }
Ejemplo n.º 3
0
        public static TResult Put <TResult, T>(this HttpWebRequest httpWebRequest, T content)
        {
            httpWebRequest.Method = HttpMethod.PUT;
            httpWebRequest.Content(content);
            var response = httpWebRequest.Send();

            return(response.Content <TResult>());
        }
Ejemplo n.º 4
0
 public static void Put <T>(this HttpWebRequest httpWebRequest, T content)
 {
     httpWebRequest.Method = HttpMethod.PUT;
     httpWebRequest.Content(content);
     using (var response = httpWebRequest.Send())
     {
         response.EnsureSuccess();
     }
 }
Ejemplo n.º 5
0
 public static void Put <TResult, T>(this HttpWebRequest httpWebRequest, T content, Action <TResult> successCallback, Action <Exception> errorCallback)
 {
     httpWebRequest.Method = HttpMethod.PUT;
     try
     {
         httpWebRequest.Content(content);
         httpWebRequest.Send(successCallback, errorCallback);
     }
     catch (WebException ex)
     {
         if (errorCallback != null)
         {
             errorCallback(ex);
         }
     }
 }
Ejemplo n.º 6
0
 public static TResult Get <TResult>(this HttpWebRequest httpWebRequest)
 {
     httpWebRequest.Method = HttpMethod.GET;
     return(httpWebRequest.Send <TResult>());
 }
Ejemplo n.º 7
0
 public static void Delete <TResult>(this HttpWebRequest httpWebRequest, Action <TResult> successCallback, Action <Exception> errorCallback)
 {
     httpWebRequest.Method = HttpMethod.DELETE;
     httpWebRequest.Send(successCallback, errorCallback);
 }