/// <inheritdoc/> /// <remarks> /// The default implementation first verifies that the content type of the response is acceptable /// according to the <c>Accept</c> header of the request. If acceptable, the body is assumed to be /// in JSON syntax and is deserialized using <see cref="JsonConvert.DeserializeObject{T}(string)"/>. /// Otherwise, the method returns the default value of type <typeparamref name="T"/>. /// </remarks> protected override Task <T> DeserializeResultImplAsync(HttpResponseMessage response, CancellationToken cancellationToken) { bool acceptable = HttpApiCall.IsAcceptable(response); return(response.Content.ReadAsStringAsync() .Select(task => acceptable ? JsonConvert.DeserializeObject <T>(task.Result) : default(T))); }
/// <inheritdoc/> public virtual Task <Tuple <HttpResponseMessage, TResult> > SendAsync(CancellationToken cancellationToken) { return(HttpApiCall.SendAsync(cancellationToken) .Select(task => Tuple.Create(task.Result.Item1, Selector(task.Result.Item1, task.Result.Item2, cancellationToken)))); }