Skip to content

Instantly share code, notes, and snippets.

@andreabalducci
Created May 10, 2013 15:35
Show Gist options
  • Select an option

  • Save andreabalducci/5555207 to your computer and use it in GitHub Desktop.

Select an option

Save andreabalducci/5555207 to your computer and use it in GitHub Desktop.
public class ResponseContentMd5Handler : DelegatingHandler
{
protected async override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request,
System.Threading.CancellationToken cancellationToken)
{
HttpResponseMessage response = await base.SendAsync(request, cancellationToken);
if (response.IsSuccessStatusCode && response.Content != null)
{
response.Content.Headers.ContentMD5 = await MD5Helper.ComputeHash(response.Content);
}
return response;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment