From ab68986efc95eba8c1e4b30ab8acb4fc1bd7e509 Mon Sep 17 00:00:00 2001 From: Angus Salkeld Date: Tue, 11 Dec 2012 12:47:35 +1100 Subject: [PATCH] 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. --- wsme/rest/args.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wsme/rest/args.py b/wsme/rest/args.py index a68849e..9c31f35 100644 --- a/wsme/rest/args.py +++ b/wsme/rest/args.py @@ -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)