Skip to content

Instantly share code, notes, and snippets.

@darrelmiller
Created September 5, 2012 03:21
Show Gist options
  • Save darrelmiller/3629815 to your computer and use it in GitHub Desktop.
Save darrelmiller/3629815 to your computer and use it in GitHub Desktop.
Alternative handler
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request,
CancellationToken cancellationToken)
{
var tcs = new TaskCompletionSource<HttpResponseMessage>();
Interlocked.Increment(ref count);
var response = new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new StringContent("HELLO WORLD")
};
tcs.SetResult(response);
return tcs.Task;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment