Don't read the body if content_length is 0-like

This commit is contained in:
Christophe de Vienne 2013-01-17 23:21:24 +01:00
parent b7ede0b27f
commit a29633c846

View File

@ -109,12 +109,16 @@ class RestProtocol(Protocol):
request = context.request request = context.request
funcdef = context.funcdef funcdef = context.funcdef
body = None
if request.content_length not in (None, 0, '0'):
body = request.body
args, kwargs = wsme.rest.args.combine_args( args, kwargs = wsme.rest.args.combine_args(
funcdef, funcdef,
wsme.rest.args.args_from_params(funcdef, request.params, wsme.rest.args.args_from_params(funcdef, request.params,
context.inmime), context.inmime),
wsme.rest.args.args_from_body( wsme.rest.args.args_from_body(
funcdef, request.body, request.content_type) funcdef, body, request.content_type)
) )
assert len(args) == 0 assert len(args) == 0
return kwargs return kwargs