-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[7.12] [core.http] Cleanup catch-all route for paths with trailing sl…
…ashes. (#96889) (#97677) * [core.http] Cleanup catch-all route for paths with trailing slashes. (#96889) # Conflicts: # src/core/server/core_app/core_app.ts # src/core/server/core_app/integration_tests/core_app_routes.test.ts * Fix eslint failures.
- Loading branch information
1 parent
d075a04
commit abb04c5
Showing
2 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import * as kbnTestServer from '../../../../core/test_helpers/kbn_server'; | ||
|
||
describe('Core app routes', () => { | ||
let root; | ||
|
||
beforeAll(async function () { | ||
root = kbnTestServer.createRoot({ | ||
plugins: { initialize: false }, | ||
server: { | ||
basePath: '/base-path', | ||
}, | ||
}); | ||
|
||
await root.setup(); | ||
await root.start(); | ||
}); | ||
|
||
afterAll(async function () { | ||
await root.shutdown(); | ||
}); | ||
|
||
describe('`/{path*}` route', () => { | ||
it('does not redirect if the path starts with `//`', async () => { | ||
await kbnTestServer.request.get(root, '//some-path/').expect(404); | ||
}); | ||
|
||
it('does not redirect if the path does not end with `/`', async () => { | ||
await kbnTestServer.request.get(root, '/some-path').expect(404); | ||
}); | ||
}); | ||
}); |