Beispiel #1
0
        protected virtual void ProcessExceptionResponse(MvxRestRequest restRequest, Exception ex, Action <MvxRestResponse> continueAction)
        {
            var restResponse = new MvxRestResponse
            {
                Tag        = restRequest?.Tag,
                StatusCode = HttpStatusCode.BadRequest
            };

            continueAction?.Invoke(restResponse);
        }
        protected virtual void ProcessResponse(MvxRestRequest restRequest, HttpWebRequest httpRequest, Action <MvxRestResponse> successAction)
        {
            httpRequest.BeginGetResponse(result =>
            {
                var response = (HttpWebResponse)httpRequest.EndGetResponse(result);

                var code = response.StatusCode;

                var restResponse = new MvxRestResponse
                {
                    CookieCollection = response.Cookies,
                    Tag        = restRequest.Tag,
                    StatusCode = code
                };
                successAction?.Invoke(restResponse);
            }, null);
        }
        protected virtual void ProcessResponse(
            MvxRestRequest restRequest,
            HttpWebRequest httpRequest,
            Action<MvxRestResponse> successAction,
            Action<Exception> errorAction)
        {
            httpRequest.BeginGetResponse(result =>
                                         TryCatch(() =>
                                             {
                                                 var response = (HttpWebResponse)httpRequest.EndGetResponse(result);

                                                 var code = response.StatusCode;

                                                 var restResponse = new MvxRestResponse
                                                 {
                                                     CookieCollection = response.Cookies,
                                                     Tag = restRequest.Tag,
                                                     StatusCode = code
                                                 };
                                                 successAction?.Invoke(restResponse);
                                             }, errorAction)
                                         , null);
        }
        protected virtual void ProcessExceptionResponse(MvxRestRequest restRequest, Exception ex, Action<MvxRestResponse> continueAction)
        {
            var restResponse = new MvxRestResponse
            {
                Tag = restRequest?.Tag,
                StatusCode = HttpStatusCode.BadRequest
            };

            continueAction?.Invoke(restResponse);
        }