summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--oslo_middleware/sizelimit.py2
-rw-r--r--oslo_middleware/tests/test_sizelimit.py6
2 files changed, 1 insertions, 7 deletions
diff --git a/oslo_middleware/sizelimit.py b/oslo_middleware/sizelimit.py
index bba9886..026b709 100644
--- a/oslo_middleware/sizelimit.py
+++ b/oslo_middleware/sizelimit.py
@@ -89,7 +89,7 @@ class RequestBodySizeLimiter(base.ConfigurableMiddleware):
req.content_length > max_size):
msg = _("Request is too large.")
raise webob.exc.HTTPRequestEntityTooLarge(explanation=msg)
- if req.content_length is None and req.is_body_readable:
+ if req.content_length is None:
limiter = LimitingReader(req.body_file, max_size)
req.body_file = limiter
return self.application
diff --git a/oslo_middleware/tests/test_sizelimit.py b/oslo_middleware/tests/test_sizelimit.py
index 42622ae..3d57a61 100644
--- a/oslo_middleware/tests/test_sizelimit.py
+++ b/oslo_middleware/tests/test_sizelimit.py
@@ -100,9 +100,3 @@ class TestRequestBodySizeLimiter(test_base.BaseTestCase):
self.request.body = b"0" * (self.MAX_REQUEST_BODY_SIZE + 1)
response = self.request.get_response(self.middleware)
self.assertEqual(413, response.status_int)
-
- def test_request_too_large_no_content_length(self):
- self.request.body = b"0" * (self.MAX_REQUEST_BODY_SIZE + 1)
- self.request.headers['Content-Length'] = None
- response = self.request.get_response(self.middleware)
- self.assertEqual(413, response.status_int)