mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
parent
cafd497bd1
commit
37d701a121
@ -127,8 +127,8 @@ export default function getApp(
|
||||
});
|
||||
|
||||
app.get(`${baseUriPath}/*`, (req, res) => {
|
||||
if (req.path.includes('api')) {
|
||||
res.status(404).send();
|
||||
if (req.path.startsWith(`${baseUriPath}/api`)) {
|
||||
res.status(404).send({ message: '404 - Not found' });
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@ unleash.start(
|
||||
},
|
||||
server: {
|
||||
enableRequestLogger: true,
|
||||
baseUriPath: '',
|
||||
},
|
||||
logLevel: LogLevel.debug,
|
||||
enableOAS: true,
|
||||
|
@ -27,7 +27,16 @@ test('hitting a baseUri path returns HTML document', async t => {
|
||||
test('hitting an api path that does not exist returns 404', async t => {
|
||||
t.plan(0);
|
||||
const request = await setupAppWithBaseUrl(stores);
|
||||
await request.get('/hosted/api/i-dont-exist').expect(404);
|
||||
await request.get('/api/i-dont-exist').expect(404);
|
||||
});
|
||||
|
||||
test('hitting an /admin/api returns HTML document', async t => {
|
||||
t.plan(0);
|
||||
const request = await setupAppWithBaseUrl(stores);
|
||||
await request
|
||||
.get('/admin/api')
|
||||
.expect(200)
|
||||
.expect('Content-Type', 'text/html; charset=utf-8');
|
||||
});
|
||||
|
||||
test('hitting a non-api returns HTML document', async t => {
|
||||
|
Loading…
Reference in New Issue
Block a user