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:
Angus Salkeld 2012-12-11 12:47:35 +11:00
parent 2277370fca
commit ab68986efc

View File

@ -149,12 +149,12 @@ def args_from_body(funcdef, body, mimetype):
else:
datatypes = dict(((a.name, a.datatype) for a in funcdef.arguments))
if not body:
return (), {}
if mimetype in restjson.accept_content_types:
dataformat = restjson
elif mimetype in restxml.accept_content_types:
dataformat = restxml
elif not body:
return (), {}
else:
raise ValueError("Unknow mimetype: %s" % mimetype)