Esempio n. 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 async Task <MvxRestResponse> ProcessResponse(MvxRestRequest restRequest, HttpWebRequest httpRequest)
        {
            var response = (HttpWebResponse)await httpRequest.GetResponseAsync().ConfigureAwait(false);

            var restResponse = new MvxRestResponse
            {
                CookieCollection = response.Cookies,
                Tag        = restRequest.Tag,
                StatusCode = response.StatusCode
            };

            return(restResponse);
        }
Esempio n. 3
0
        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);
        }