Problem
The WSGI adapter has a few small branches that are important but not directly covered by tests yet.
Current tests cover normal request body reads, negative CONTENT_LENGTH, body limits, missing CONTENT_LENGTH, path decoding, event-loop calls, and response finalizers:
But these two WSGI adapter paths are still easy to miss:
- missing
wsgi.input returns an empty body: adapter code
- invalid non-numeric
CONTENT_LENGTH is treated as invalid by the request safety layer before the body is read: adapter code
This is small test coverage work, but it protects compatibility behavior for WSGI deployments.
Proposed behavior
Add focused tests in tests/integration/test_wsgi_adapter.py:
- when
wsgi.input is missing, a handler that reads the body should receive b"";
- when
CONTENT_LENGTH is invalid, the response should be 400 Bad Request with Invalid Content-Length header, and the input stream should not be read.
Keep the tests narrow. No runtime behavior change is expected unless the tests reveal a bug.
Alternatives considered
We could leave this to broader adapter tests, but these branches are small and easy to assert directly.
API sketch
Working on this?
Please wait until a maintainer marks the issue accepted. After that, comment before starting and make sure nobody else is assigned or already working on it.
Problem
The WSGI adapter has a few small branches that are important but not directly covered by tests yet.
Current tests cover normal request body reads, negative
CONTENT_LENGTH, body limits, missingCONTENT_LENGTH, path decoding, event-loop calls, and response finalizers:But these two WSGI adapter paths are still easy to miss:
wsgi.inputreturns an empty body: adapter codeCONTENT_LENGTHis treated as invalid by the request safety layer before the body is read: adapter codeThis is small test coverage work, but it protects compatibility behavior for WSGI deployments.
Proposed behavior
Add focused tests in
tests/integration/test_wsgi_adapter.py:wsgi.inputis missing, a handler that reads the body should receiveb"";CONTENT_LENGTHis invalid, the response should be400 Bad RequestwithInvalid Content-Length header, and the input stream should not be read.Keep the tests narrow. No runtime behavior change is expected unless the tests reveal a bug.
Alternatives considered
We could leave this to broader adapter tests, but these branches are small and easy to assert directly.
API sketch
# No public API change.Working on this?
Please wait until a maintainer marks the issue
accepted. After that, comment before starting and make sure nobody else is assigned or already working on it.