I'm trying to upload a file as octet-stream with RestSharp 1.7 but can't get it to work.
I've tried the following approaches:
Using restRequest.AddFile("file", documentContent, MediaTypeNames.Application.Octet); This doesn't generate an octet-stream even if I specify it.
Using restRequest.AddBody(documentContent, MediaTypeNames.Application.Octet); This seems to generate an octet-stream but the content doesn't seem to be the correct byte content. This worked on v.1.6.
If anyone have a working version of uploading streaming file data for RestSharp v.1.7 it would be greatly appreciated.
This is a bug in RestSharp v.107 according to this https://github.com/restsharp/RestSharp/issues/1761 and the correction here: https://github.com/restsharp/RestSharp/commit/a7d2662ef95269fab1e6dac2ef2ad3003c5c1e85
The solution for now is to use the following:
restRequest.AddParameter(new BodyParameter("", byteArrayContent, MediaTypeNames.Application.Octet, DataFormat.Binary));