Open
Description
Describe the bug
File Content not added to Request as it would be expected
To Reproduce
public async Task<bool> Upload(Stream fileStream, int id, bool force = false){
var request = new RestRequest("https://2c24d1e3-8470-479b-baa6-4eecb2f85faa.mock.pstmn.io/Upload/{id}");
var fileParam = FileParameter.Create("upload",() => fileStream,"upload.png");
request.AddUrlSegment("id", id.ToString());
request.AddQueryParameter("force", force.ToString());
´ //request.AddFile("upload.png",() => fileStream,"upload.png"); //Code before, also not working
request.AddFile("upload","C:\\Users\\Franz Seidl\\OneDrive\\Bilder\\testImage.png");
var result = await this._client.PostAsync<bool>(request);
return result;
}
Expected behavior
File should be added to Body
Stack trace
No Stack Trace available
Desktop (please complete the following information):
- OS: Windows 11 Pro
- .NET version :8.0.8
- Version 112.1.0.0
Additional context
Another interesting Detail when Sending the request per Postman, the Request.ContentLength is 1444 the same value as the FileStream. But when Sending with RestSharp the Request.Content is 1643. May be the file is not encoded correctly.