2

trying to post a byte array or memory stream with RestSharp.

I have tried the following

request.AddFile("stream", x => new MemoryStream(blocks.First().Value), "stream", "application/binary");

And

request.AddFile("stream", blocks.First().Value, "stream", "application/binary");

Where blocks.First().Value is a Byte Array

On the server end I am expecting a form with stream parameter in it that I can extract the bytes from.

Additional information: Adding null or string.Empty to AddFile sends the byte array

request.AddFile("stream", blocks.First().Value, string.Empty);

The problem is that it adds 2 bytes to each byte array sent (1 for carriage return and one for new line). And I cannot remove them on every post on server side since other clients do not behave this way.

Thank you for any input on this!

4

1 回答 1

0

我们在 Nancy 0.11 中通过拉取请求修复了它,因此这不再是问题。

于 2012-05-23T18:08:54.027 回答