[6.x] Make /api/security/v1/login to return 204 status code if no payload is provided. (#21406)

This commit is contained in:
Aleh Zasypkin 2018-07-30 17:12:33 +02:00 committed by GitHub
parent 7cc15bcb46
commit 45d754e4b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 2 deletions

View file

@ -64,6 +64,9 @@ describe('Authentication routes', () => {
username: Joi.string().required(),
password: Joi.string().required()
}
},
response: {
emptyStatusCode: 204,
}
});
});

View file

@ -23,6 +23,9 @@ export function initAuthenticateApi(server) {
username: Joi.string().required(),
password: Joi.string().required()
}
},
response: {
emptyStatusCode: 204,
}
},
async handler(request, reply) {

View file

@ -54,7 +54,7 @@ export default function ({ getService }) {
const loginResponse = await supertest.post('/api/security/v1/login')
.set('kbn-xsrf', 'xxx')
.send({ username: validUsername, password: validPassword })
.expect(200);
.expect(204);
const cookies = loginResponse.headers['set-cookie'];
expect(cookies).to.have.length(1);
@ -111,7 +111,7 @@ export default function ({ getService }) {
const loginResponse = await supertest.post('/api/security/v1/login')
.set('kbn-xsrf', 'xxx')
.send({ username: validUsername, password: validPassword })
.expect(200);
.expect(204);
sessionCookie = request.cookie(loginResponse.headers['set-cookie'][0]);
});