mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-04 00:18:01 +01:00
fix: exporting only feature toggles as yaml should not crash
fixes #615
This commit is contained in:
parent
25082a69ae
commit
91eab0550c
@ -69,7 +69,9 @@ class StateController extends Controller {
|
|||||||
if (downloadFile) {
|
if (downloadFile) {
|
||||||
res.attachment(`export-${timestamp}.yml`);
|
res.attachment(`export-${timestamp}.yml`);
|
||||||
}
|
}
|
||||||
res.type('yaml').send(YAML.safeDump(data));
|
res.type('yaml').send(
|
||||||
|
YAML.safeDump(data, { skipInvalid: true }),
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
if (downloadFile) {
|
if (downloadFile) {
|
||||||
res.attachment(`export-${timestamp}.json`);
|
res.attachment(`export-${timestamp}.json`);
|
||||||
|
@ -39,6 +39,15 @@ test.serial('exports strategies and features as yaml', async t => {
|
|||||||
.expect(200);
|
.expect(200);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test.serial('exports only features as yaml', async t => {
|
||||||
|
t.plan(0);
|
||||||
|
const request = await setupApp(stores);
|
||||||
|
return request
|
||||||
|
.get('/api/admin/state/export?format=yaml&featureToggles=1')
|
||||||
|
.expect('Content-Type', /yaml/)
|
||||||
|
.expect(200);
|
||||||
|
});
|
||||||
|
|
||||||
test.serial('exports strategies and features as attachment', async t => {
|
test.serial('exports strategies and features as attachment', async t => {
|
||||||
t.plan(0);
|
t.plan(0);
|
||||||
const request = await setupApp(stores);
|
const request = await setupApp(stores);
|
||||||
|
Loading…
Reference in New Issue
Block a user