refactor: server: auth: destructure

This commit is contained in:
coderiaser 2024-11-22 12:17:10 +02:00
parent dff0267239
commit da0e99ad8c
2 changed files with 5 additions and 4 deletions

View file

@ -16,8 +16,9 @@ module.exports = (config) => {
function _middle(config, authentication, req, res, next) { function _middle(config, authentication, req, res, next) {
const is = config('auth'); const is = config('auth');
const {originalUrl} = req;
if (!is || req.originalUrl.startsWith("/public/")) if (!is || originalUrl.startsWith('/public/'))
return next(); return next();
const success = () => next(); const success = () => next();

View file

@ -186,12 +186,12 @@ test('cloudcmd: manifest.json', async (t) => {
const options = { const options = {
config, config,
}; };
const {status} = await request.get('/public/manifest.json', { const {status} = await request.get('/public/manifest.json', {
options, options,
}); });
t.equal(status, 200, 'should return manifest.json even when authentication is enabled'); t.equal(status, 200, 'should return manifest.json even when authentication is enabled');
t.end(); t.end();
}); });