/ justapi / tests / test_sse.py
swadhinbiswas test: add end-to-end integration test suite with gRPC and proto stubs · 7/9/2026
43e015f
13 lines · 286 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
import asyncio
from justapi import JustAPIApp, TokenStreamResponse

app = JustAPIApp()

@app.get("/stream")
async def stream():
    async def gen():
        for i in range(5):
            yield f"data: {i}\n\n"
            await asyncio.sleep(0.1)
    return TokenStreamResponse(gen())