Skip to content

Instantly share code, notes, and snippets.

@thomaslevesque
Created June 1, 2014 21:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomaslevesque/048785e08bcac31c21ae to your computer and use it in GitHub Desktop.
Save thomaslevesque/048785e08bcac31c21ae to your computer and use it in GitHub Desktop.
class PushStreamContent : HttpContent
{
private readonly Func<Stream, Task> _pushAction;
public PushStreamContent(Func<Stream, Task> pushAction)
{
_pushAction = pushAction;
}
protected override async Task SerializeToStreamAsync(Stream stream, TransportContext context)
{
await _pushAction(stream);
}
protected override bool TryComputeLength(out long length)
{
length = -1;
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment