pre-commit-ci-lite[bot]
3 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
3 additions and
4 deletions
-
fastapi/routing.py
-
tests/test_sse.py
|
|
|
@ -1801,7 +1801,7 @@ class APIRouter(routing.Router): |
|
|
|
and getattr(route, "stream_item_type", None) is not None |
|
|
|
): |
|
|
|
new_route.stream_item_type = route.stream_item_type |
|
|
|
|
|
|
|
|
|
|
|
elif isinstance(route, routing.Route): |
|
|
|
methods = list(route.methods or []) |
|
|
|
self.add_route( |
|
|
|
|
|
|
|
@ -264,6 +264,7 @@ def test_sse_on_router_included_in_app(client: TestClient): |
|
|
|
] |
|
|
|
assert len(data_lines) == 2 |
|
|
|
|
|
|
|
|
|
|
|
def test_include_router_copies_stream_item_type(): |
|
|
|
sub_router = APIRouter() |
|
|
|
|
|
|
|
@ -276,12 +277,10 @@ def test_include_router_copies_stream_item_type(): |
|
|
|
main_app = FastAPI() |
|
|
|
main_app.include_router(sub_router) |
|
|
|
|
|
|
|
route = next(r for r in main_app.routes |
|
|
|
if r.path == "/stream_item_type") |
|
|
|
route = next(r for r in main_app.routes if r.path == "/stream_item_type") |
|
|
|
assert getattr(route, "stream_item_type", None) == Item |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Keepalive ping tests |
|
|
|
|
|
|
|
|
|
|
|
|