sysid / sse-starlette

BSD 3-Clause "New" or "Revised" License
505 stars 36 forks source link

Postman SSE Support does not work #47

Closed hburrichter closed 1 year ago

hburrichter commented 1 year ago

First of all, thank you for the great repository!

Postman recently gained support for SSE and it works as expected for some SSE endpoints I found online.

However, I tried to implement a Server-Sent Events endpoint using FastAPI/Starlette with the built-in Starlette StreamingResponse and your SSE-Startlette GitHub repo and neither of them produced the new streaming UI in Postman.

Any Idea on what might be the cause?

(tested it with your "usage" code from the repo readme)

hburrichter commented 1 year ago

Related to this issue: https://github.com/postmanlabs/postman-app-support/issues/11753

Setting the header manually to:

return EventSourceResponse(
            content=...,
            headers={
                'content-type': 'text/event-stream',
            }
        )

fixes the issue.

sysid commented 1 year ago

Thanks @hburrichter for this insight. I probably should update the README accordingly.