-
-
Notifications
You must be signed in to change notification settings - Fork 730
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
Add multipart/form-data support #88
Comments
As someone who doesn't use multipart form data requests, I can still see the value in it. It probably makes sense for this module to be able to parse multipart forms. But is there a need? Are people happy to bring in an extra library to handle it (e.g busboy)? |
People don't ever seem to be happy :) |
Ahh
Yes, this would be nice. :) |
This comment has been minimized.
This comment has been minimized.
Yes this is a highly needed feature. :) Basically the body parsing options are:
|
What can we do to gain some traction on this issue? Would someone like to collaborate on implementing this? |
Hi @macmichael01 so you are interested in a parser that would drop the files, then? |
"a parser that would drop the files" - That would be a nice work around for now. Full file upload support would be even better. I'm guessing that are some security obstacles. |
@macmichael01 , this module will never have full file upload, as it does not fit into the fundamental design. You'll always have to reach for the modules listed in the readme for parsing with file support. |
@dougwilson That's fine. Should I open a new ticket for suggestion that you made? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
+1 for this, specially since XMLHttpRequest 2 now supports FormData() Currently using
|
This comment has been minimized.
This comment has been minimized.
Hi @0x70b1a5 it was my impression from the conversation above that a PR would have been coming, but none ever materialized. You're absolutely welcome to tackle this based on the implementation discussed above. The issue is open so people are aware that it is something they could work on and contribute towards if they are so inclined to do so. I personally simply use the multipart parsers listed in the README directly and don't have any issues accepting multipart data; the issue was opened because I kept closing the requests for this, so this would be the tracking request. If I closed this, I'm sure new issues will start popping up just like they used to. If you have a better solution, please let me know. |
This comment has been minimized.
This comment has been minimized.
For anyone else stumbling across this issue, express-form-data does the job pretty well |
I think the main annoyance is that we already are bringing in an extra library (in addition to |
If we uses serverless and a node server like NestJs. The request body will be converted to Buffer and forward to nodejs server, if we don't have multipart parser, we can not read the file upload. |
This comment was marked as spam.
This comment was marked as spam.
simple dependency free workaround: app.post('/upload', async (req, res) => {
const formData = await new Response(req, { headers: req.headers }).formData()
const files = formData.getAll('files')
}) (require NodeJS v18+) |
This worked for me. I already did it for uploads, I just had to put it always on base route and not just uploads. No other change needed. |
This is just such a basic type of the web, it's hard to keep ignoring it. Because of the pattern of this module, though, we really cannot support files. But I don't see why we can support it, but just drop files. Thoughts?
The text was updated successfully, but these errors were encountered: