mirror of https://github.com/gin-gonic/gin.git
Merge branch 'master' of github.com:gin-gonic/gin
This commit is contained in:
commit
5196d455c8
|
@ -11,6 +11,7 @@ import (
|
||||||
"mime/multipart"
|
"mime/multipart"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -351,7 +352,7 @@ func TestContextRenderSSE(t *testing.T) {
|
||||||
"bar": "foo",
|
"bar": "foo",
|
||||||
})
|
})
|
||||||
|
|
||||||
assert.Equal(t, w.Body.String(), "event:float\ndata:1.5\n\nid:123\ndata:text\n\nevent:chat\ndata:{\"bar\":\"foo\",\"foo\":\"bar\"}\n\n")
|
assert.Equal(t, strings.Replace(w.Body.String(), " ", "", -1), strings.Replace("event:float\ndata:1.5\n\nid:123\ndata:text\n\nevent:chat\ndata:{\"bar\":\"foo\",\"foo\":\"bar\"}\n\n", " ", "", -1))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestContextRenderFile(t *testing.T) {
|
func TestContextRenderFile(t *testing.T) {
|
||||||
|
|
|
@ -6,6 +6,7 @@ package gin
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
@ -245,11 +246,5 @@ func TestMiddlewareWrite(t *testing.T) {
|
||||||
w := performRequest(router, "GET", "/")
|
w := performRequest(router, "GET", "/")
|
||||||
|
|
||||||
assert.Equal(t, w.Code, 400)
|
assert.Equal(t, w.Code, 400)
|
||||||
assert.Equal(t, w.Body.String(), `hola
|
assert.Equal(t, strings.Replace(w.Body.String(), " ", "", -1), strings.Replace("hola\n<map><foo>bar</foo></map>{\"foo\":\"bar\"}\n{\"foo\":\"bar\"}\nevent:test\ndata:message\n\n", " ", "", -1))
|
||||||
<map><foo>bar</foo></map>{"foo":"bar"}
|
|
||||||
{"foo":"bar"}
|
|
||||||
event:test
|
|
||||||
data:message
|
|
||||||
|
|
||||||
`)
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue