Skip to content

Instantly share code, notes, and snippets.

@darrelmiller
Created February 22, 2012 04:53
Show Gist options
  • Save darrelmiller/1881538 to your computer and use it in GitHub Desktop.
Save darrelmiller/1881538 to your computer and use it in GitHub Desktop.
public class IWantJSONDammit : DelegatingHandler
{
protected override Task<HttpResponseMessage> SendAsync(
HttpRequestMessage request, CancellationToken cancellationToken)
{
request.Headers.Accept.Clear();
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
return base.SendAsync(request,cancellationToken);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment