Skip to content

Commit

Permalink
[6.x] Make /api/security/v1/login to return 204 status code if no…
Browse files Browse the repository at this point in the history
… payload is provided. (elastic#21406)
  • Loading branch information
azasypkin authored Jul 30, 2018
1 parent 7cc15bc commit 45d754e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ describe('Authentication routes', () => {
username: Joi.string().required(),
password: Joi.string().required()
}
},
response: {
emptyStatusCode: 204,
}
});
});
Expand Down
3 changes: 3 additions & 0 deletions x-pack/plugins/security/server/routes/api/v1/authenticate.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ export function initAuthenticateApi(server) {
username: Joi.string().required(),
password: Joi.string().required()
}
},
response: {
emptyStatusCode: 204,
}
},
async handler(request, reply) {
Expand Down
4 changes: 2 additions & 2 deletions x-pack/test/api_integration/apis/security/basic_login.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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]);
});
Expand Down

0 comments on commit 45d754e

Please sign in to comment.