Body-Parser interacts with express-stormpath weirdly
If I do:
app.use(bodyParser.json())
app.use(stormpath.init(app, {}))
express-stormpath breaks on any urlencoded things, and complains that body isn't set.
Expected behavior:
express-stormpath still parses form-urlencoded stuff.
I'm not sure what "complains that body isn't set" meant, but here is a reproduction branch:
https://github.com/stormpath/express-stormpath-sample-project/commit/aa687f06bf2c1ca221992ff6afe3104ebbba0805
In that branch, if I try to submit the login form, nothing happens (I get sent back to the same form). So we should figure out what is causing this and fix the problem.
I'm not sure this is actually a bug. I will admit that I'm not that experienced working with Express, but I think this is expected behaviour. If only the json parser is set, it only parses JSON correctly (as far as I've understood the docs), and the form provides urlencoded data. If you add the urlencoded parser as well, it all works as expected.
app.use(bodyParser.json());
app.use(bodyParser.urlencoded());
or even (though deprecated):
app.use(bodyParser());
Maybe this is just something that should be documented?