sysid / sse-starlette

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

UnicodeDecodeError #41

Closed yukw777 closed 1 year ago

yukw777 commented 1 year ago

I'm trying to use sse-starlette to stream raw bytes (e.g. live videos). I've noticed that EventSourceResponse tries to decode chunk for debug logging (https://github.com/sysid/sse-starlette/blob/28b06b9d277673a7a291bfdb0e9d496f7fe0a0ca/sse_starlette/sse.py#L206 and https://github.com/sysid/sse-starlette/blob/28b06b9d277673a7a291bfdb0e9d496f7fe0a0ca/sse_starlette/sse.py#L265), which raises a UnicodeDecodeError as chunk in my case is binary. What would be the best way to fix it? Happy to send a PR based on your suggestion.