-
-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stdlib wsgiref
requires argument for read()
#477
stdlib wsgiref
requires argument for read()
#477
Conversation
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`.
Short example on how to reproduce:
|
I think you're right. Could you please add a test for this? And add yourself to AUTHORS file. Thanks. |
Added a test, please let me know if it's ok for webargs and/or if the patch needs anything else. |
tests/test_falconparser.py
Outdated
@@ -42,3 +43,10 @@ def test_invalid_json(self, testapp): | |||
def test_parsing_headers(self, testapp): | |||
res = testapp.get("/echo_headers", headers={"name": "Fred"}) | |||
assert res.json == {"NAME": "Fred"} | |||
|
|||
# `falcon.testing.TestClient.simulate_request` parses request with `wsgiref` | |||
def test_body_parsing_works_with_simulate(self, testapp): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think testapp is needed, here. Is it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, it's not - updated.
Thanks. |
PEP3333 says:
However, Python standard library
wsgiref
does not allow callingread
without arguments. Falcon test client
falcon.testing.TestClient
useswsgiref
- therefore content length should be passed an argument toread
.