0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

Merge pull request #5504 from kowsheek/5499-error-format

Make the 401 error format consistent
This commit is contained in:
Hannah Wolfe 2015-07-02 19:32:17 +01:00
commit fc6b93b9f4

View file

@ -120,13 +120,13 @@ middleware = {
} }
// Generate a JSON response reflecting authentication status // Generate a JSON response reflecting authentication status
if (!user) { if (!user) {
var msg = { var error = {
type: 'error', code: 401,
message: 'Please Sign In', errorType: 'NoPermissionError',
status: 'passive' message: 'Please Sign In'
}; };
res.status(401);
return res.send(msg); return apiErrorHandlers.errorHandler(error, req, res, next);
} }
// TODO: figure out, why user & authInfo is lost // TODO: figure out, why user & authInfo is lost
req.authInfo = info; req.authInfo = info;