mirror of
https://github.com/Unleash/unleash.git
synced 2025-03-04 00:18:40 +01:00
fix: return 400 on invalid JSON instead of 404 (#1897)
This commit is contained in:
parent
d4b9ca443c
commit
df910cc20c
@ -59,7 +59,7 @@ export class OpenApiService {
|
|||||||
validation: err.validationErrors,
|
validation: err.validationErrors,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
next();
|
next(err);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -340,6 +340,15 @@ test('require new feature toggle to have a name', async () => {
|
|||||||
.expect(400);
|
.expect(400);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should return 400 on invalid JSON data', async () => {
|
||||||
|
expect.assertions(0);
|
||||||
|
return app.request
|
||||||
|
.post('/api/admin/features')
|
||||||
|
.send(`{ invalid-json }`)
|
||||||
|
.set('Content-Type', 'application/json')
|
||||||
|
.expect(400);
|
||||||
|
});
|
||||||
|
|
||||||
test('can not change status of feature toggle that does not exist', async () => {
|
test('can not change status of feature toggle that does not exist', async () => {
|
||||||
expect.assertions(0);
|
expect.assertions(0);
|
||||||
return app.request
|
return app.request
|
||||||
|
Loading…
Reference in New Issue
Block a user