From a7df1043c338ea106cb745abcec70a3ce4e879a1 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Sat, 28 Mar 2015 10:22:57 +0100 Subject: Test of the headers was to strict. --- pyaggr3g470r/views/api/common.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pyaggr3g470r/views/api/common.py b/pyaggr3g470r/views/api/common.py index 424df960..405d6b2c 100644 --- a/pyaggr3g470r/views/api/common.py +++ b/pyaggr3g470r/views/api/common.py @@ -149,7 +149,7 @@ class PyAggResourceMulti(PyAggAbstractResource): """retrieve several objects. filters can be set in the payload on the different fields of the object, and a limit can be set in there as well """ - if 'application/json' != request.headers.get('Content-Type'): + if 'application/json' not in request.headers.get('Content-Type'): raise BadRequest("Content-Type must be application/json") limit = 10 try: @@ -163,7 +163,7 @@ class PyAggResourceMulti(PyAggAbstractResource): def post(self): """creating several objects. payload should be a list of dict. """ - if 'application/json' != request.headers.get('Content-Type'): + if 'application/json' not int request.headers.get('Content-Type'): raise BadRequest("Content-Type must be application/json") status = 201 results = [] @@ -184,7 +184,7 @@ class PyAggResourceMulti(PyAggAbstractResource): [[obj_id1, {attr1: val1, attr2: val2}] [obj_id2, {attr1: val1, attr2: val2}]] """ - if 'application/json' != request.headers.get('Content-Type'): + if 'application/json' not in request.headers.get('Content-Type'): raise BadRequest("Content-Type must be application/json") status = 200 results = [] @@ -206,7 +206,6 @@ class PyAggResourceMulti(PyAggAbstractResource): """will delete several objects, a list of their ids should be in the payload""" if 'application/json' not in request.headers.get('Content-Type'): - print(request.headers.get('Content-Type')) raise BadRequest("Content-Type must be application/json") status = 204 results = [] -- cgit