Using sse.ContentType instead of hardcoded one
This commit is contained in:
parent
a8b9e2d8d6
commit
662a35d209
@ -19,7 +19,7 @@ func (_ sseRender) Render(w http.ResponseWriter, code int, data ...interface{})
|
|||||||
func WriteSSEvent(w http.ResponseWriter, eventName string, data interface{}) error {
|
func WriteSSEvent(w http.ResponseWriter, eventName string, data interface{}) error {
|
||||||
header := w.Header()
|
header := w.Header()
|
||||||
if len(header.Get("Content-Type")) == 0 {
|
if len(header.Get("Content-Type")) == 0 {
|
||||||
header.Set("Content-Type", "text/event-stream")
|
header.Set("Content-Type", sse.ContentType)
|
||||||
}
|
}
|
||||||
return sse.Encode(w, sse.Event{
|
return sse.Encode(w, sse.Event{
|
||||||
Event: eventName,
|
Event: eventName,
|
||||||
|
Loading…
Reference in New Issue
Block a user