pre-commit-ci-lite[bot]
5 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
6 additions and
3 deletions
-
fastapi/responses.py
-
tests/test_sse_response.py
|
|
|
@ -1,4 +1,5 @@ |
|
|
|
from typing import Any, AsyncGenerator, Literal |
|
|
|
from collections.abc import AsyncGenerator |
|
|
|
from typing import Any |
|
|
|
|
|
|
|
from fastapi.exceptions import FastAPIDeprecationWarning |
|
|
|
from starlette.responses import FileResponse as FileResponse # noqa |
|
|
|
|
|
|
|
@ -1,8 +1,8 @@ |
|
|
|
"""Tests for Server-Sent Events (SSE) response.""" |
|
|
|
|
|
|
|
from collections.abc import AsyncGenerator |
|
|
|
from typing import Any |
|
|
|
|
|
|
|
import pytest |
|
|
|
from fastapi import FastAPI |
|
|
|
from fastapi.responses import SSEResponse, sse_content |
|
|
|
from fastapi.testclient import TestClient |
|
|
|
@ -143,7 +143,9 @@ def test_sse_content_helper(): |
|
|
|
|
|
|
|
from starlette.responses import StreamingResponse |
|
|
|
|
|
|
|
return StreamingResponse(sse_content(generator()), media_type="text/event-stream") |
|
|
|
return StreamingResponse( |
|
|
|
sse_content(generator()), media_type="text/event-stream" |
|
|
|
) |
|
|
|
|
|
|
|
client = TestClient(app, raise_server_exceptions=False) |
|
|
|
response = client.get("/events") |
|
|
|
|