mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
refactor: server: auth: destructure
This commit is contained in:
parent
dff0267239
commit
da0e99ad8c
2 changed files with 5 additions and 4 deletions
|
|
@ -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();
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue