diff --git a/sse-encoder.go b/sse-encoder.go index f9c8087..3761b0d 100644 --- a/sse-encoder.go +++ b/sse-encoder.go @@ -18,7 +18,7 @@ import ( // W3C Working Draft 29 October 2009 // http://www.w3.org/TR/2009/WD-eventsource-20091029/ -const ContentType = "text/event-stream" +const ContentType = "text/event-stream;charset=utf-8" var contentType = []string{ContentType} var noCache = []string{"no-cache"} diff --git a/sse_test.go b/sse_test.go index ae3e1fd..553ba29 100644 --- a/sse_test.go +++ b/sse_test.go @@ -198,7 +198,7 @@ func TestRenderSSE(t *testing.T) { assert.NoError(t, err) assert.Equal(t, w.Body.String(), "event:msg\ndata:hi! how are you?\n\n") - assert.Equal(t, w.Header().Get("Content-Type"), "text/event-stream") + assert.Equal(t, w.Header().Get("Content-Type"), "text/event-stream;charset=utf-8") assert.Equal(t, w.Header().Get("Cache-Control"), "no-cache") }