twitchax / AspNetCore.Proxy

ASP.NET Core Proxies made easy.
MIT License
524 stars 83 forks source link

Multi-file request support #109

Open dotfortun3-code opened 1 year ago

dotfortun3-code commented 1 year ago

When uploading multiple files, an InvalidOperationException would occur when the request is forwarded. Copying the content to a MemoryStream first stops the exception from occurring.

Updated ToHttpContent helper function to copy files to a MemoryStream to prevent InvalidOperationException from occuring when multiple files are sent.

twitchax commented 11 months ago

Hey, sorry for the delay.

Can you add a passing / failing test that exercise this case, and the counter case?

twitchax commented 1 month ago

Hi @dotfortun3-code, I cannot repro this issue in the test. I have added more files to the CanProxyControllerPostWithFormAndFilesRequest test. Is there any way you can provide more context, or add a test that fails due to this issue?

walterancona commented 3 weeks ago

try to create an api with a multiform/form-data body in post, that accepts a IFormFileCollection in the body. You'll see instantly the problem.

twitchax commented 3 weeks ago

Ok, cool. I will try to get to this. If possible, it would be extremely helpful if you could add the test that would have failed, but is fixed by this PR, so that it remains covered.

dotfortun3-code commented 3 weeks ago

I can probably take a look at adding the test soon-ish. I just had a baby a few weeks ago so I've been a little tied up haha!

twitchax commented 3 weeks ago

Woohoo! Congrats!

walterancona commented 3 weeks ago

Congratulations!!! The problem is that the test passes, but in real cases the api gives back 200, but the files are not uploaded in the folder, so maybe this should be checked in the test. I've tried it but not succeeded.