mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +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, | ||||
|                 }); | ||||
|             } else { | ||||
|                 next(); | ||||
|                 next(err); | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
|  | ||||
| @ -340,6 +340,15 @@ test('require new feature toggle to have a name', async () => { | ||||
|         .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 () => { | ||||
|     expect.assertions(0); | ||||
|     return app.request | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user