r3labs / sse

Server Sent Events server and client for Golang
Mozilla Public License 2.0
870 stars 180 forks source link

Add w.WriteHeader() call before first Flush() #119

Closed wdscxsj closed 3 years ago

wdscxsj commented 3 years ago

This change makes the SSE server work with chi's Compress middleware. Compress uses response headers to determine if the response body is compressible, so the headers should be written out before flushing. Hope this change can save other users a couple of hours of digging.

purehyperbole commented 3 years ago

Hey @wdscxsj

Thanks for submitting the fix! I will merge this now and create a new release