Skip to content
Discussion options

You must be logged in to vote

A few times while developing Remix Apps I've mistakenly used request.json() in my action in an attempt to grab the submitted data only to realize that I should be using request.formData because the incoming request was actually a form submission (you'll see 'Content-Type' : 'application/x-www-form-urlencoded' in the coming request).

This happened to me today, when I was using an 3rd party library in my Remix app, which was sending its POST data via a form submission ('Content-Type' : 'application/x-www-form-urlencoded') but I had mistakenly assumed it was coming in as application/json.

Below is the error outputted when I attempted to use await request.json() on the incoming request, which…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@kiliman
Comment options

@sergiodxa
Comment options

@cliffordfajardo
Comment options

@KrishnaPG
Comment options

Answer selected by kiliman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants