From a29633c8468708081ecdaae7f96d63f7d5a9685a Mon Sep 17 00:00:00 2001 From: Christophe de Vienne Date: Thu, 17 Jan 2013 23:21:24 +0100 Subject: [PATCH] Don't read the body if content_length is 0-like --- wsme/rest/protocol.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/wsme/rest/protocol.py b/wsme/rest/protocol.py index 1a4f73e..705dcb1 100644 --- a/wsme/rest/protocol.py +++ b/wsme/rest/protocol.py @@ -109,12 +109,16 @@ class RestProtocol(Protocol): request = context.request funcdef = context.funcdef + body = None + if request.content_length not in (None, 0, '0'): + body = request.body + args, kwargs = wsme.rest.args.combine_args( funcdef, wsme.rest.args.args_from_params(funcdef, request.params, context.inmime), wsme.rest.args.args_from_body( - funcdef, request.body, request.content_type) + funcdef, body, request.content_type) ) assert len(args) == 0 return kwargs