Fixed status code for unauthenticated requests

refs https://github.com/TryGhost/Team/issues/498

Requests to fetch the data of the logged in member made without a
session cookie were responsing with 400 Bad Request. This was incorrect
and always should have been a 401 Unauthorized.
This commit is contained in:
Fabien O'Carroll 2021-03-01 16:03:56 +00:00
parent 41d9610aef
commit 24afc5d4ff
2 changed files with 2 additions and 2 deletions

View File

@ -51,7 +51,7 @@ const getMemberData = async function (req, res) {
res.json(null);
}
} catch (err) {
res.writeHead(err.statusCode);
res.writeHead(401);
res.end(err.message);
}
};

View File

@ -50,7 +50,7 @@ describe('Basic Members Routes', function () {
it('should error for invalid member token on member data endpoint', async function () {
await request.get('/members/api/member')
.expect(400);
.expect(401);
});
it('should serve member site endpoint', async function () {