예제 #1
0
        protected override async Task <HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
        {
            // 设置匿名请求的标记
            request.RequestUri = new Uri(request.RequestUri.ToString() + "&&_allow_anonymous=true");
            var response = await base.SendAsync(request, cancellationToken);

            var message = await HttpRestService.HandleHttpIO(request, response);

            return(message);
        }
예제 #2
0
        protected override async Task <HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
        {
            // See if the request has an authorize header
            if (request.Headers.Authorization == null)
            {
                var token = App.GetHttpToken();
                request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
            }
            var response = await base.SendAsync(request, cancellationToken);

            var message = await HttpRestService.HandleHttpIO(request, response);

            return(message);
        }