1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

fix: exporting only feature toggles as yaml should not crash

fixes #615
This commit is contained in:
Ivar Conradi Østhus 2020-07-30 23:57:13 +02:00
parent 25082a69ae
commit 91eab0550c
2 changed files with 12 additions and 1 deletions

View File

@ -69,7 +69,9 @@ class StateController extends Controller {
if (downloadFile) {
res.attachment(`export-${timestamp}.yml`);
}
res.type('yaml').send(YAML.safeDump(data));
res.type('yaml').send(
YAML.safeDump(data, { skipInvalid: true }),
);
} else {
if (downloadFile) {
res.attachment(`export-${timestamp}.json`);

View File

@ -39,6 +39,15 @@ test.serial('exports strategies and features as yaml', async t => {
.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 => {
t.plan(0);
const request = await setupApp(stores);