Move the check for an empty body up.
So if you have a client that always sets the Accept json but you are doing a GET and the body is empty, then we get an exception.
This commit is contained in:
parent
2277370fca
commit
ab68986efc
@ -149,12 +149,12 @@ def args_from_body(funcdef, body, mimetype):
|
|||||||
else:
|
else:
|
||||||
datatypes = dict(((a.name, a.datatype) for a in funcdef.arguments))
|
datatypes = dict(((a.name, a.datatype) for a in funcdef.arguments))
|
||||||
|
|
||||||
|
if not body:
|
||||||
|
return (), {}
|
||||||
if mimetype in restjson.accept_content_types:
|
if mimetype in restjson.accept_content_types:
|
||||||
dataformat = restjson
|
dataformat = restjson
|
||||||
elif mimetype in restxml.accept_content_types:
|
elif mimetype in restxml.accept_content_types:
|
||||||
dataformat = restxml
|
dataformat = restxml
|
||||||
elif not body:
|
|
||||||
return (), {}
|
|
||||||
else:
|
else:
|
||||||
raise ValueError("Unknow mimetype: %s" % mimetype)
|
raise ValueError("Unknow mimetype: %s" % mimetype)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user