I have the following Web API method in an ApiController class:
public HttpResponseMessage Post([FromBody]byte[] incomingData)
{
...
}
I want incomingData
to be the raw content of the POST. But it seems that the Web API stack attempts to parse the incoming data with the JSON formatter, and this causes the following code on the client side to fail:
new WebClient().UploadData("http://localhost:15134/api/Foo", new byte[] { 1, 2, 3 });
Is there a simple workaround for this?