Update .travis.yml, update README.md and add support for gin-gonic/gin/pull/781
This commit is contained in:
+11
-2
@@ -1,6 +1,15 @@
|
|||||||
language: go
|
language: go
|
||||||
sudo: false
|
sudo: false
|
||||||
go:
|
go:
|
||||||
- 1.3
|
- 1.6.4
|
||||||
- 1.4
|
- 1.7.4
|
||||||
- tip
|
- tip
|
||||||
|
|
||||||
|
git:
|
||||||
|
depth: 3
|
||||||
|
|
||||||
|
script:
|
||||||
|
- go test -v -covermode=count -coverprofile=coverage.out
|
||||||
|
|
||||||
|
after_success:
|
||||||
|
- bash <(curl -s https://codecov.io/bash)
|
||||||
@@ -1,4 +1,9 @@
|
|||||||
#Server-Sent Events [](https://godoc.org/github.com/gin-contrib/sse) [](https://travis-ci.org/gin-contrib/sse)
|
# Server-Sent Events
|
||||||
|
|
||||||
|
[](https://godoc.org/github.com/gin-contrib/sse)
|
||||||
|
[](https://travis-ci.org/gin-contrib/sse)
|
||||||
|
[](https://codecov.io/gh/gin-contrib/sse)
|
||||||
|
[](https://goreportcard.com/report/github.com/gin-contrib/sse)
|
||||||
|
|
||||||
Server-sent events (SSE) is a technology where a browser receives automatic updates from a server via HTTP connection. The Server-Sent Events EventSource API is [standardized as part of HTML5[1] by the W3C](http://www.w3.org/TR/2009/WD-eventsource-20091029/).
|
Server-sent events (SSE) is a technology where a browser receives automatic updates from a server via HTTP connection. The Server-Sent Events EventSource API is [standardized as part of HTML5[1] by the W3C](http://www.w3.org/TR/2009/WD-eventsource-20091029/).
|
||||||
|
|
||||||
|
|||||||
+5
-1
@@ -87,13 +87,17 @@ func writeData(w stringWriter, data interface{}) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r Event) Render(w http.ResponseWriter) error {
|
func (r Event) Render(w http.ResponseWriter) error {
|
||||||
|
r.WriteContentType(w)
|
||||||
|
return Encode(w, r)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r Event) WriteContentType(w http.ResponseWriter) {
|
||||||
header := w.Header()
|
header := w.Header()
|
||||||
header["Content-Type"] = contentType
|
header["Content-Type"] = contentType
|
||||||
|
|
||||||
if _, exist := header["Cache-Control"]; !exist {
|
if _, exist := header["Cache-Control"]; !exist {
|
||||||
header["Cache-Control"] = noCache
|
header["Cache-Control"] = noCache
|
||||||
}
|
}
|
||||||
return Encode(w, r)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func kindOfData(data interface{}) reflect.Kind {
|
func kindOfData(data interface{}) reflect.Kind {
|
||||||
|
|||||||
Reference in New Issue
Block a user