Skip to content

Commit

Permalink
stdlib wsgiref requires argument for read()
Browse files Browse the repository at this point in the history
PEP3333 says:

> A server should allow read() to be called without an argument, and
> return the remainder of the client's input stream.

However, Python standard library `wsgiref` does not allow calling `read`
without arguments. Falcon test client `falcon.testing.TestClient` uses
`wsgiref` - therefore content length should be passed an argument to
`read`.
  • Loading branch information
Sami Salonen committed Feb 21, 2020
1 parent 8d11273 commit cf09a90
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/webargs/falconparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def _raw_load_json(self, req):
non-json, even if the request body is parseable as json."""
if not is_json_request(req) or req.content_length in (None, 0):
return core.missing
body = req.stream.read()
body = req.stream.read(req.content_length)
if body:
return core.parse_json(body)
else:
Expand Down

0 comments on commit cf09a90

Please sign in to comment.