From: Andres Buraschi Date: Thu, 28 Nov 2013 14:35:07 +0000 (-0300) Subject: Fixing check order for empty body in get_body() X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=6bd4dae9680aae924ef24750e15f00711c14b1a3;p=openstack-build%2Fcinder-build.git Fixing check order for empty body in get_body() Cinder API logged the following debug message for each request with empty body: "Unrecognized Content-Type provided in request get_body" Check order was fixed in get_body function to follow the correct flow and display the right message (empty body). Change-Id: Ie561983a4da791a412fea3fc390dab718dfce191 Closes-Bug: #1252692 --- diff --git a/cinder/api/openstack/wsgi.py b/cinder/api/openstack/wsgi.py index d2eee19cf..70d127e81 100644 --- a/cinder/api/openstack/wsgi.py +++ b/cinder/api/openstack/wsgi.py @@ -790,6 +790,11 @@ class Resource(wsgi.Application): return args def get_body(self, request): + + if len(request.body) == 0: + LOG.debug(_("Empty body provided in request")) + return None, '' + try: content_type = request.get_content_type() except exception.InvalidContentType: @@ -800,10 +805,6 @@ class Resource(wsgi.Application): LOG.debug(_("No Content-Type provided in request")) return None, '' - if len(request.body) <= 0: - LOG.debug(_("Empty body provided in request")) - return None, '' - return content_type, request.body def deserialize(self, meth, content_type, body):