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

Support file uploads #618

Merged
merged 1 commit into from
Nov 9, 2023
Merged

Conversation

alistair
Copy link
Contributor

closes #572

@jeremydmiller
Copy link
Member

Hey @alistair, the code looks good as far as I can tell, but would you add an end to end test to that somehow?

@jeremydmiller jeremydmiller added this to the 1.11.0 milestone Nov 9, 2023
@jeremydmiller jeremydmiller merged commit c605de7 into JasperFx:main Nov 9, 2023
1 check passed
@Xzelsius
Copy link
Contributor

@alistair How is this supposed to work?

So far, I had to use MVC controllers for file uploads instead of Wolverine endpoints.
I now tried to migrate them to Wolverine but I can't figure out on how to make them working :D

Must IFormFile be an endpoint argument or can it be inside the request model?

In our case we used this in MVC

public record CreateAttachmentRequest(Guid AttachmentFolderId, IFormFile Attachment);

and marked the controller action with [Consumes("multipart/form-data")].
This way, our Swagger looked like this

image

But if I use the same model with Wolverine, it does not work.

If I specify IFormFile as endpoint parameter (instead of inside the model) my Swagger forces me to decide between uploading a file body or JSON payload. Which is wrong in both cases.

image
or
image

And either way Wolverine won't accept the same request that our frontend sends.
Would be nice if you could help me out :)

@nkosi23
Copy link

nkosi23 commented Dec 19, 2023

@Xzelsius Have you tried adding the [FromForm] attribute to your IFormFile parameter (passed as a method argument, the second approach you mention)

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

Successfully merging this pull request may close these issues.

Support file uploads in Wolverine.Http
4 participants