Esempio n. 1
0
        protected override async Task <HttpResponseMessage> SendAsync(HttpRequestMessage request,
                                                                      CancellationToken cancellationToken)
        {
            var response = await base.SendAsync(request, cancellationToken);

            var content = await response.Content.ReadAsStringAsync();

            if (string.IsNullOrEmpty(content))
            {
                return(response);
            }

            try
            {
                var result = JsonConvert.DeserializeObject <BaseResponse>(content);
                if (ForceLogoutRequired(result.Code))
                {
                    AppOutdated?.Invoke(this, result);
                }
            }
            catch (JsonException)
            {
            }

            return(response);
        }
Esempio n. 2
0
        protected override async Task <HttpResponseMessage> SendAsync(HttpRequestMessage request,
                                                                      CancellationToken cancellationToken)
        {
            HttpResponseMessage response = await base.SendAsync(request, cancellationToken);

            BaseResponse baseResponse = await response.GetBaseResponseMessage();

            if (baseResponse == null)
            {
                return(response);
            }

            if (ForceLogoutRequired(baseResponse.Code))
            {
                AppOutdated?.Invoke(this, baseResponse);
            }

            return(response);
        }