Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File not transfered #2273

Open
fseidl-bauradar opened this issue Nov 15, 2024 · 0 comments
Open

File not transfered #2273

fseidl-bauradar opened this issue Nov 15, 2024 · 0 comments
Labels

Comments

@fseidl-bauradar
Copy link
Contributor

fseidl-bauradar commented Nov 15, 2024

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;
    }

grafik

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant