mirror of
https://github.com/Unleash/unleash.git
synced 2025-04-10 01:16:39 +02:00
parent
cafd497bd1
commit
37d701a121
@ -127,8 +127,8 @@ export default function getApp(
|
|||||||
});
|
});
|
||||||
|
|
||||||
app.get(`${baseUriPath}/*`, (req, res) => {
|
app.get(`${baseUriPath}/*`, (req, res) => {
|
||||||
if (req.path.includes('api')) {
|
if (req.path.startsWith(`${baseUriPath}/api`)) {
|
||||||
res.status(404).send();
|
res.status(404).send({ message: '404 - Not found' });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ unleash.start(
|
|||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
enableRequestLogger: true,
|
enableRequestLogger: true,
|
||||||
|
baseUriPath: '',
|
||||||
},
|
},
|
||||||
logLevel: LogLevel.debug,
|
logLevel: LogLevel.debug,
|
||||||
enableOAS: true,
|
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 => {
|
test('hitting an api path that does not exist returns 404', async t => {
|
||||||
t.plan(0);
|
t.plan(0);
|
||||||
const request = await setupAppWithBaseUrl(stores);
|
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 => {
|
test('hitting a non-api returns HTML document', async t => {
|
||||||
|
Loading…
Reference in New Issue
Block a user