Skip to content

Instantly share code, notes, and snippets.

@davidbreyer
Created October 9, 2019 19:54
Show Gist options
  • Save davidbreyer/42c9d0c142f66f14467b030a5fa82fdc to your computer and use it in GitHub Desktop.
Save davidbreyer/42c9d0c142f66f14467b030a5fa82fdc to your computer and use it in GitHub Desktop.
//HttpRequest
byte[] bytesInStream = new byte[req.ContentLength.GetValueOrDefault()];
req.Body.Read(bytesInStream, 0, bytesInStream.Length);
//HttpRequestMessage
using (Stream requestStream = await req.Content.ReadAsStreamAsync())
{
byte[] bytesInStream = new byte[requestStream.Length];
requestStream.Read(bytesInStream, 0, (int)bytesInStream.Length);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment