コード例 #1
0
ファイル: HttpRestService.cs プロジェクト: ychost/tesla_wpf
        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
ファイル: HttpRestService.cs プロジェクト: ychost/tesla_wpf
        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);
        }