Przeglądaj źródła

Adds travis and godocs banners

Manu Mtz-Almeida 10 lat temu
rodzic
commit
29bc476855
3 zmienionych plików z 5 dodań i 4 usunięć
  1. 3 0
      README.md
  2. 2 2
      sse-encoder.go
  3. 0 2
      sse_test.go

+ 3 - 0
README.md

@@ -1,5 +1,8 @@
 #Server-Sent Events
 
+[![GoDoc](https://godoc.org/github.com/manucorporat/sse?status.svg)](https://godoc.org/github.com/manucorporat/sse)
+[![Build Status](https://travis-ci.org/manucorporat/sse.svg)](https://travis-ci.org/manucorporat/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.
 
 [Read this great SSE introduction by the HTML5Rocks guys](http://www.html5rocks.com/en/tutorials/eventsource/basics/)

+ 2 - 2
sse-encoder.go

@@ -8,12 +8,12 @@ import (
 	"strings"
 )
 
-const ContentType = "text/event-stream"
-
 // Server-Sent Events
 // W3C Working Draft 29 October 2009
 // http://www.w3.org/TR/2009/WD-eventsource-20091029/
 
+const ContentType = "text/event-stream"
+
 type Event struct {
 	Event string
 	Id    string

+ 0 - 2
sse_test.go

@@ -2,7 +2,6 @@ package sse
 
 import (
 	"bytes"
-	"fmt"
 	"testing"
 
 	"github.com/stretchr/testify/assert"
@@ -143,6 +142,5 @@ func TestEncodeStream(t *testing.T) {
 		Event: "chat",
 		Data:  "hi! dude",
 	})
-	fmt.Println(w.String())
 	assert.Equal(t, w.String(), "event: float\ndata: 1.5\n\nid: 123\ndata: {\"bar\":\"foo\",\"foo\":\"bar\"}\n\nid: 124\nevent: chat\ndata: hi! dude\n\n")
 }