summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/gorilla/handlers/handlers_go18_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/gorilla/handlers/handlers_go18_test.go')
-rw-r--r--vendor/github.com/gorilla/handlers/handlers_go18_test.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/vendor/github.com/gorilla/handlers/handlers_go18_test.go b/vendor/github.com/gorilla/handlers/handlers_go18_test.go
new file mode 100644
index 000000000..c8cfa722f
--- /dev/null
+++ b/vendor/github.com/gorilla/handlers/handlers_go18_test.go
@@ -0,0 +1,34 @@
+// +build go1.8
+
+package handlers
+
+import (
+ "io/ioutil"
+ "net/http"
+ "net/http/httptest"
+ "testing"
+)
+
+func TestLoggingHandlerWithPush(t *testing.T) {
+ handler := http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
+ if _, ok := w.(http.Pusher); !ok {
+ t.Fatalf("%T from LoggingHandler does not satisfy http.Pusher interface when built with Go >=1.8", w)
+ }
+ w.WriteHeader(200)
+ })
+
+ logger := LoggingHandler(ioutil.Discard, handler)
+ logger.ServeHTTP(httptest.NewRecorder(), newRequest("GET", "/"))
+}
+
+func TestCombinedLoggingHandlerWithPush(t *testing.T) {
+ handler := http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
+ if _, ok := w.(http.Pusher); !ok {
+ t.Fatalf("%T from CombinedLoggingHandler does not satisfy http.Pusher interface when built with Go >=1.8", w)
+ }
+ w.WriteHeader(200)
+ })
+
+ logger := CombinedLoggingHandler(ioutil.Discard, handler)
+ logger.ServeHTTP(httptest.NewRecorder(), newRequest("GET", "/"))
+}