Closed davetapley closed 9 months ago
Hi,
I'm not sure I understand the request. that check is performed by https://docs.python.org/3/library/wsgiref.html#module-wsgiref.validate
I think you can pass -1 to read everything
Oh I see! Yes that works.
It looks like the WSGI server I'm using (CherryPy) allows None
, which was the source of the confusion.
@davetapley Yes, the test client currently uses wsgiref
for validation and gluing of some parts. AFAICT your issue is already tracked as #1617.
I did a bad thing: I wrote implementation code before a test (don't judge me), but at least I uncovered a bug 🤪
In my implementation I used
request.stream.read()
, and it worked when testing manually, but when I wrote the test usingTestClient
it failed with:I was able to work around this by using
request.bounded_stream.read()
.I guess there's a clue in the docs which say:
Hopefully this can still be mocked out in
TestClient
?I'd prefer to use
stream
because the docs also note: