-
-
Save thomaslevesque/048785e08bcac31c21ae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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