Upload file with swagger ui crash
I'm trying to upload IFormFIle with swagger ui and as soon as I select file and click select or cancel the backend application crashes without any error displayed. Can I fix it? Is it better to switch to Postman?
8 Replies
Run the debugger, step through the code, see where exactly it crashes?
did you try debug your code? I Guess the problem is how you uploading file
means it is after 1st if
The application crashes right after I click "open" or "cancel" button on the file selection window. The endpoint works fine if I send file with Postman. I'm curious if anybody encountered this problem in swagger ui before and knows how to solve it
then have no idea
I'm alwo writing a file upload endpoint. No issues uploading files so far. Feel free to glance at my code and follow the code-review here:
https://discord.com/channels/143867839282020352/1300831004411428994
What happens if you cut out
putObjectArgs
entirely?
Also, why is formFile
nullable?Do you upload with swagger? The endpoint is totally fine and works if I upload file with the postman. The problem is that it doesn't even hit this endpoint (I guess). Nullable if because the file might not be sent with the request
Yes. Both Swagger and Postman work when I upload a file
Put a debugger in your
Program.cs
file where you're mapping the contollers and step through. If everything else fails generate a fresh project and move your endpoint there to see what the problem is. What also helps is posting a ling to your repo to see your project setup and configurationI found the problem and it actually was a browser Brave. I don't know why exactly it crashes my app, but I switched to other and it's working fine now