2
0

Conforms to new Render API

This commit is contained in:
Manu Mtz-Almeida
2015-06-04 11:11:00 +02:00
parent 8dbe678801
commit c142f0f1ba
2 changed files with 6 additions and 3 deletions
+1 -1
View File
@@ -80,7 +80,7 @@ func writeData(w stringWriter, data interface{}) error {
return nil
}
func (r Event) Write(w http.ResponseWriter) error {
func (r Event) Render(w http.ResponseWriter) error {
header := w.Header()
header["Content-Type"] = contentType
+5 -2
View File
@@ -156,7 +156,7 @@ func TestRenderSSE(t *testing.T) {
err := (Event{
Event: "msg",
Data: "hi! how are you?",
}).Write(w)
}).Render(w)
assert.NoError(t, err)
assert.Equal(t, w.Body.String(), "event: msg\ndata: hi! how are you?\n\n")
@@ -172,7 +172,7 @@ func BenchmarkResponseWriter(b *testing.B) {
(Event{
Event: "new_message",
Data: "hi! how are you? I am fine. this is a long stupid message!!!",
}).Write(w)
}).Render(w)
}
}
@@ -187,6 +187,7 @@ func BenchmarkFullSSE(b *testing.B) {
Retry: 10,
Data: "hi! how are you? I am fine. this is a long stupid message!!!",
})
buf.Reset()
}
}
@@ -200,6 +201,7 @@ func BenchmarkNoRetrySSE(b *testing.B) {
Id: "13435",
Data: "hi! how are you? I am fine. this is a long stupid message!!!",
})
buf.Reset()
}
}
@@ -212,5 +214,6 @@ func BenchmarkSimpleSSE(b *testing.B) {
Event: "new_message",
Data: "hi! how are you? I am fine. this is a long stupid message!!!",
})
buf.Reset()
}
}