`request.formData()` fails when using an express server with remix
See original GitHub issueWhat version of Remix are you using?
latest
Steps to Reproduce
- setup express server to use with remix with
express.urlencoded()
andexpress.json()
- create a basic form with an ActionFunction to view the formdata
Expected Behavior
request.formData()
returns the data that was submitted to the form.
Actual Behavior
formdata is empty when using an express server, since express requests don’t conform to the fetch api.
While I will admit that this is perhaps not a bug, I do think that since we assume that all requests (at least in ActionFunctions) conform to the fetch api that request.formData()
should work? However, this could be a feature request rather than a bug.
A possible solution is to adjust the createRequestHandler for express to add formdata?
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:16 (1 by maintainers)
Top Results From Across the Web
Technical Explanation - Remix
Technical Explanation. This document hopes to answer the question: "What is Remix?" Remix is four things: A compiler; A server side HTTP handler;...
Read more >Remix Run - fetch returning empty response - Stack Overflow
I am pretty new to Remix and am running it with an express server backend. I have the following routes setup: routes ->...
Read more >How to validate forms in Remix - LogRocket Blog
Remix takes a different approach from React when it comes to ... a POST request containing the form data to the server using...
Read more >Implementing Strapi v4 Authentication with Remix
In this article, we'll create a Remix application with authentication and authorization using... Tagged with strapi, remix, javascript, ...
Read more >Strapi v4 Authentication with Remix - Medium
The “Remix App Server” is a full-featured Node.js server based on Express. ... You can get it from GitHub and use it to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@khowling
request.formData()
works regardless of the server and you don’t need to add any middleware to Express to make it work, actually if you add body-parser to Express it will stop working on Remix because the body of a request can only be read once.Are you sure your FormData comes empty? If you did
console.log(formData)
and saw in your terminal thisFormData {}
as if it was an empty object, that’s expected, FormData is a data structure not a plain object, you need to doformData.get("the name of an input")
to access the data.Jeez, thank you very much!