You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The type option is used to determine what media type the middleware will parse. [...] Defaults to application/x-www-form-urlencoded.
So I expected bodyParser.urlencoded to do nothing if Content-Type is not application/x-www-form-urlencoded. But bodyParser.urlencoded still adds an empty object to req.body, even if the type is not met. This way it gets unnecessarily hard to use multiple body parser for different types and check for an empty body.
Seeing that changing this behaviour might break existing apps, I'd suggest to add an option to configure this behaviour and maybe change the default in the future. What do you think?
The text was updated successfully, but these errors were encountered:
From the docs of
bodyParser.urlencoded
:So I expected
bodyParser.urlencoded
to do nothing ifContent-Type
is notapplication/x-www-form-urlencoded
. ButbodyParser.urlencoded
still adds an empty object toreq.body
, even if the type is not met. This way it gets unnecessarily hard to use multiple body parser for different types and check for an empty body.Seeing that changing this behaviour might break existing apps, I'd suggest to add an option to configure this behaviour and maybe change the default in the future. What do you think?
The text was updated successfully, but these errors were encountered: