Exemple #1
0
        protected override async System.Threading.Tasks.Task <HttpResponseMessage> SendAsync(HttpRequestMessage request, System.Threading.CancellationToken cancellationToken)
        {
            var serializer = _messageSerializers.FirstOrDefault(p => p.HandlesContentType(HttpContext.Current.Request.ContentType)) ?? new DefaultMessageSerializer();

            request = serializer.OnRequest(request, cancellationToken);
            var response = await base.SendAsync(request, cancellationToken);

            var links = _responseProvider.CreateLinks(response); // TODO Async?! Why?!

            return(serializer.OnResponse(request, response, ((ObjectContent)response.Content).Value, links));
        }