mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-19 00:15:43 +01:00
fix: move /api/admin/features
This commit is contained in:
parent
8571250b3a
commit
65cdd9f3a9
@ -41,7 +41,6 @@ class FeatureController extends Controller {
|
|||||||
this.service = featureToggleServiceV2;
|
this.service = featureToggleServiceV2;
|
||||||
|
|
||||||
if (!config.disableLegacyFeaturesApi) {
|
if (!config.disableLegacyFeaturesApi) {
|
||||||
this.get('/', this.getAllToggles);
|
|
||||||
this.post('/', this.createToggle, CREATE_FEATURE);
|
this.post('/', this.createToggle, CREATE_FEATURE);
|
||||||
this.get('/:featureName', this.getToggle);
|
this.get('/:featureName', this.getToggle);
|
||||||
this.put('/:featureName', this.updateToggle, UPDATE_FEATURE);
|
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.post('/:featureName/stale/off', this.staleOff, UPDATE_FEATURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.get('/', this.getAllToggles);
|
||||||
this.post('/validate', this.validate, NONE);
|
this.post('/validate', this.validate, NONE);
|
||||||
this.get('/:featureName/tags', this.listTags);
|
this.get('/:featureName/tags', this.listTags);
|
||||||
this.post('/:featureName/tags', this.addTag, UPDATE_FEATURE);
|
this.post('/:featureName/tags', this.addTag, UPDATE_FEATURE);
|
||||||
|
@ -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
|
await appWithDisabledLegacyFeatures.request
|
||||||
.get('/api/admin/features/featureX')
|
.get('/api/admin/features/featureX')
|
||||||
.expect('Content-Type', /json/)
|
.expect('Content-Type', /json/)
|
||||||
@ -745,3 +741,16 @@ test('should hit validate and tags endpoint if legacy api is disabled', async ()
|
|||||||
.send({ name: 'validateThis' })
|
.send({ name: 'validateThis' })
|
||||||
.expect(200);
|
.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);
|
||||||
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user