MCPcopy Index your code
hub / github.com/fastapi/fastapi / test_post_method_sse

Function test_post_method_sse

tests/test_sse.py:172–180  ·  view source on GitHub ↗

SSE should work with POST (needed for MCP compatibility).

(client: TestClient)

Source from the content-addressed store, hash-verified

170
171
172def test_post_method_sse(client: TestClient):
173 """SSE should work with POST (needed for MCP compatibility)."""
174 response = client.post("/items/stream-post")
175 assert response.status_code == 200
176 assert response.headers["content-type"] == "text/event-stream; charset=utf-8"
177 data_lines = [
178 line for line in response.text.strip().split("\n") if line.startswith("data: ")
179 ]
180 assert len(data_lines) == 3
181
182
183def test_sse_events_with_fields(client: TestClient):

Callers

nothing calls this directly

Calls 1

postMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…