Default response should be JSON, if not specified
If I set:
app.use(stormpath.init(app, {
web: {
produces: ['application/json']
}
}));
And I send a HTTP request to a route with stormpath.loginRequired without an Accept header, Stormpath redirects me to /login?next=route
Expected behavior: Stormpath returns 401 Unauthorized
HTTP logs:
GET /notes
HTTP/1.1 302 Found
X-Powered-By: Express
Location: /login?next=%2Fnotes
Vary: Accept
Content-Type: text/plain; charset=utf-8
Content-Length: 44
Date: Fri, 11 Mar 2016 22:54:32 GMT
GET /notes
Accept: application/json
HTTP/1.1 401 Unauthorized
X-Powered-By: Express
Date: Fri, 11 Mar 2016 22:54:46 GMT
Doing further testing, the express-stormpath framework doesn't follow this part of the framework spec:
# If the request does not specify an Accept header, or the preferred accept
# type is */*, the integration must respond with the first type in this
# list.

This issue is now tracking our need to implement our content negotiation strategy, as defined here:
https://github.com/stormpath/stormpath-framework-spec/blob/master/requests.md#content-type-negotiation
Update: I'm now considering this a breaking change, as it would change the default behavior of this library. @typerandom do you agree? I'm thinking we need to hold off and make this part of a 4.0 release.