dspace_statistics_api/app.py: Use bounded_stream in on_post

For reasons I don't quite understand, we need to use bounded_stream
in the on_post request handler in order to use simulate_post() with
the testing client in Falcon 2.0.0. Normal runtime operation via
gunicorn does not have any issues with stream.

See: https://github.com/falconry/falcon/issues/1720
See: https://github.com/falconry/falcon/issues/1554
This commit is contained in:
Alan Orth 2020-09-26 11:50:12 +03:00
parent b06651d1ec
commit 946f0749e2
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9
1 changed files with 1 additions and 1 deletions

View File

@ -66,7 +66,7 @@ class AllItemsResource:
# Only attempt to read the POSTed request if its length is not 0 (or
# rather, in the Python sense, if length is not a False-y value).
if req.content_length:
doc = json.load(req.stream)
doc = json.load(req.bounded_stream)
else:
raise falcon.HTTPBadRequest(
title="Invalid request", description=f"Request body is empty."