diff --git a/gin_integration_test.go b/gin_integration_test.go
index b80cbb24..9beec14d 100644
--- a/gin_integration_test.go
+++ b/gin_integration_test.go
@@ -8,6 +8,7 @@ import (
"bufio"
"crypto/tls"
"fmt"
+ "html/template"
"io/ioutil"
"net"
"net/http"
@@ -69,6 +70,42 @@ func TestRunTLS(t *testing.T) {
testRequest(t, "https://localhost:8443/example")
}
+func TestPusher(t *testing.T) {
+ var html = template.Must(template.New("https").Parse(`
+
+
+ Https Test
+
+
+
+ Welcome, Ginner!
+
+
+`))
+
+ router := New()
+ router.Static("./assets", "./assets")
+ router.SetHTMLTemplate(html)
+
+ go func() {
+ router.GET("/pusher", func(c *Context) {
+ if pusher := c.Writer.Pusher(); pusher != nil {
+ pusher.Push("/assets/app.js", nil)
+ }
+ c.String(http.StatusOK, "it worked")
+ })
+
+ assert.NoError(t, router.RunTLS(":8449", "./testdata/certificate/cert.pem", "./testdata/certificate/key.pem"))
+ }()
+
+ // have to wait for the goroutine to start and run the server
+ // otherwise the main thread will complete
+ time.Sleep(5 * time.Millisecond)
+
+ assert.Error(t, router.RunTLS(":8449", "./testdata/certificate/cert.pem", "./testdata/certificate/key.pem"))
+ testRequest(t, "https://localhost:8449/pusher")
+}
+
func TestRunEmptyWithEnv(t *testing.T) {
os.Setenv("PORT", "3123")
router := New()