Skip to content

Commit

Permalink
Fixes serverless common API security response headers API tests (elas…
Browse files Browse the repository at this point in the history
…tic#162655)

Unblocks elastic#162149

## Summary
Fixes serverless security response headers tests by using the internal
request header. This PR also opts to use the `/logout` redirect endpoint
in testing, as it is more relevant to serverless.
  • Loading branch information
jeramysoucy committed Jul 27, 2023
1 parent b867d42 commit 614044b
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -25,7 +25,7 @@ export default function ({ getService }: FtrProviderContext) {
it('API endpoint response contains default security headers', async () => {
const { header } = await supertest
.get(`/internal/security/me`)
.set(svlCommonApi.getCommonRequestHeader())
.set(svlCommonApi.getInternalRequestHeader())
.expect(200);

expect(header).toBeDefined();
Expand All @@ -40,9 +40,9 @@ export default function ({ getService }: FtrProviderContext) {

it('redirect endpoint response contains default security headers', async () => {
const { header } = await supertest
.get(`/login`)
.get(`/logout`)
.set(svlCommonApi.getCommonRequestHeader())
.expect(302);
.expect(200);

expect(header).toBeDefined();
expect(header['content-security-policy']).toEqual(defaultCSP);
Expand Down

0 comments on commit 614044b

Please sign in to comment.