1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-14 00:19:16 +01:00

fix: move /api/admin/features

This commit is contained in:
Fredrik Oseberg 2022-01-14 11:09:16 +01:00
parent 8571250b3a
commit 65cdd9f3a9
2 changed files with 14 additions and 5 deletions

View File

@ -41,7 +41,6 @@ class FeatureController extends Controller {
this.service = featureToggleServiceV2;
if (!config.disableLegacyFeaturesApi) {
this.get('/', this.getAllToggles);
this.post('/', this.createToggle, CREATE_FEATURE);
this.get('/:featureName', this.getToggle);
this.put('/:featureName', this.updateToggle, UPDATE_FEATURE);
@ -58,6 +57,7 @@ class FeatureController extends Controller {
this.post('/:featureName/stale/off', this.staleOff, UPDATE_FEATURE);
}
this.get('/', this.getAllToggles);
this.post('/validate', this.validate, NONE);
this.get('/:featureName/tags', this.listTags);
this.post('/:featureName/tags', this.addTag, UPDATE_FEATURE);

View File

@ -693,10 +693,6 @@ test('should not hit endpoints if disable configuration is set', async () => {
},
);
await appWithDisabledLegacyFeatures.request
.get('/api/admin/features')
.expect(404);
await appWithDisabledLegacyFeatures.request
.get('/api/admin/features/featureX')
.expect('Content-Type', /json/)
@ -745,3 +741,16 @@ test('should hit validate and tags endpoint if legacy api is disabled', async ()
.send({ name: 'validateThis' })
.expect(200);
});
test('should have access to the get all features endpoint even if api is disabled', async () => {
const appWithDisabledLegacyFeatures = await setupAppWithCustomConfig(
db.stores,
{
disableLegacyFeaturesApi: true,
},
);
await appWithDisabledLegacyFeatures.request
.get('/api/admin/features')
.expect(200);
});