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 upload with multipart/form-data and application/json #2248

Closed
Couto opened this issue Dec 3, 2014 · 3 comments
Closed

File upload with multipart/form-data and application/json #2248

Couto opened this issue Dec 3, 2014 · 3 comments
Assignees
Labels
support Questions, discussions, and general support

Comments

@Couto
Copy link

Couto commented Dec 3, 2014

I'm quite possibly taking the wrong approach here, but nevertheless I would rather ask.

I'm currently developing a small file upload module, and I would like to support uploads using multipart/form-data and application/json.

The simplest use case for my problem can be seen in this gist

However, it seems to fail to validate the application/json requests since a stream object is being sent to Joi, instead of the payload properties.

Could you share your opinion about this?
Thanks

@hueniverse
Copy link
Contributor

Well, you can't have it both ways. Either you parse the payload and validate it or you stream it.

@hueniverse hueniverse added the support Questions, discussions, and general support label Dec 4, 2014
@hueniverse hueniverse self-assigned this Dec 4, 2014
@hueniverse
Copy link
Contributor

I would recommend asking for general design question on the hapijs/discuss repo.

@Couto
Copy link
Author

Couto commented Dec 4, 2014

Never noticed that repository before! Thanks for pointing it out :)

@lock lock bot locked as resolved and limited conversation to collaborators Jan 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
support Questions, discussions, and general support
Projects
None yet
Development

No branches or pull requests

2 participants