-
Andrey Azeev authored
Replace BaseHTTPMiddleware subclass with a pure-ASGI implementation. BaseHTTPMiddleware wraps responses in _StreamingResponse and preserves the original Content-Length, so streamed bodies (JSONResponse with ensure_ascii=False, client disconnects mid-response, CORS+Prometheus+ RequestId chains) trigger: RuntimeError: Response content longer than Content-Length Public API is preserved: import path, app.add_middleware signature, HEADER_NAME constant, request.state.request_id, request_id_ctx and the echoed x-request-id response header all behave as before. BREAKING: subclasses overriding `dispatch` will break — the method no longer exists. No such consumers found in Lucente. Refs: encode/starlette#1678ee54b3f2Andrey Azeev authoredReplace BaseHTTPMiddleware subclass with a pure-ASGI implementation. BaseHTTPMiddleware wraps responses in _StreamingResponse and preserves the original Content-Length, so streamed bodies (JSONResponse with ensure_ascii=False, client disconnects mid-response, CORS+Prometheus+ RequestId chains) trigger: RuntimeError: Response content longer than Content-Length Public API is preserved: import path, app.add_middleware signature, HEADER_NAME constant, request.state.request_id, request_id_ctx and the echoed x-request-id response header all behave as before. BREAKING: subclasses overriding `dispatch` will break — the method no longer exists. No such consumers found in Lucente. Refs: encode/starlette#1678
Loading