express-stormpath icon indicating copy to clipboard operation
express-stormpath copied to clipboard

Produces application/json Unexpected Behavior

Open rdegges opened this issue 9 years ago • 1 comments

Let's say I do a GET to /login when produces: application/json is set. By default, I get a 404... This makes no sense.

If I add an Accept: application/json header, then I'll get back a 200 with the JSON schema as expected.

IMO, content type and headers should NOT have any effect on whether or not a route is found.

The same goes for doing a POST request. If I don't set BOTH Accept AND Content-Type headers when POST'ing to /login, I get back a 404.

This behavior is unexpected, and I would argue that it should be changed.

rdegges avatar Aug 03 '16 18:08 rdegges

This was also discussed in #559. When an Accept header is omitted, we should respond with the first content type that is configured in the produces list

robertjd avatar Dec 14 '16 19:12 robertjd