To make a HTTP request with a binary custom body in c#, you can use the HttpClient class provided by the System.Net.Http package.
First, you need to create an instance of HttpClient:
main.cs42 chars2 lines
Then, you can create an instance of ByteArrayContent for your custom binary body:
main.cs116 chars3 lines
Finally, you can make the HTTP request using the PostAsync method of the HttpClient instance:
main.cs161 chars3 lines
The above code will send a HTTP POST request to https://example.com/api with the binary body represented by the byte array requestBody. The response will be stored in the response variable, and its content can be read as a string using the ReadAsStringAsync method.
gistlibby LogSnag