Replace task cancellation in `BaseHTTPMiddleware` with `http.disconnect`+`recv_stream.close` (#1715)
* replace BaseMiddleware cancellation after request send with closing recv_stream + http.disconnect in receive
fixes #1438
* Add no cover pragma on pytest.fail in tests/middleware/test_base.py
Co-authored-by: Adrian Garcia Badaracco <1755071+adriangb@users.noreply.github.com>
* make http_disconnect_while_sending test more robust in the face of scheduling issues
* Fix issue with running middleware context manager
Reported in https://github.com/encode/starlette/issues/1678#issuecomment-
1172916042
Co-authored-by: Adrian Garcia Badaracco <1755071+adriangb@users.noreply.github.com>
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>