restsharpoctet-stream

Upload file as octet-stream using RestSharp 1.7


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:

If anyone have a working version of uploading streaming file data for RestSharp v.1.7 it would be greatly appreciated.


Solution

  • 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));