From d156519faf569d52a7ef17ddf4dd81dea0cadd4a Mon Sep 17 00:00:00 2001 From: Guillaume Camera Date: Thu, 7 Sep 2017 14:19:27 +0200 Subject: [PATCH] refs #257, Add default dict to have right content-type --- demo/tests/test_integration.py | 4 +++- formidable/views.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/demo/tests/test_integration.py b/demo/tests/test_integration.py index 25420de1..270178b0 100644 --- a/demo/tests/test_integration.py +++ b/demo/tests/test_integration.py @@ -409,8 +409,9 @@ def test_validate_data_ok(self): parameters, format='json' ) self.assertEqual(res.status_code, 204) + self.assertIn('application/json', str(res.serialize_headers())) - def test_validate_does_not_exist(self): + def test_formidable_does_not_exist(self): parameters = { 'first_name': 'Guillaume', 'last_name': 'GĂ©rard', @@ -438,6 +439,7 @@ def test_validate_data_ko(self): self.assertEqual(res.status_code, 400) errors = res.data self.assertIn('first_name', errors) + self.assertIn('application/json', str(res.serialize_headers())) def test_validate_with_mandatory_file(self): class WithFile(FormidableForm): diff --git a/formidable/views.py b/formidable/views.py index d5d752dc..fbc91f66 100644 --- a/formidable/views.py +++ b/formidable/views.py @@ -266,7 +266,7 @@ def get_form_class_kwargs(self): } def form_valid(self, form): - return Response(status=204) + return Response({}, status=204) def form_invalid(self, form): # TODO change response when UI ready