Here's a sample code on how to make an HTTP request with a custom binary body and receive a binary response using HttpClient
and HttpRequestMessage
:
main.cs888 chars29 lines
This code creates an HTTP POST request to a specified uri
with a custom binary body body
. The content type of the request is set to application/octet-stream
. The response is read as a byte array and returned as a task. If the response status code is not success, an exception is thrown.
gistlibby LogSnag