summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/gorilla/handlers
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/gorilla/handlers')
-rw-r--r--vendor/github.com/gorilla/handlers/README.md2
-rw-r--r--vendor/github.com/gorilla/handlers/handlers.go2
-rw-r--r--vendor/github.com/gorilla/handlers/handlers_go18.go21
-rw-r--r--vendor/github.com/gorilla/handlers/handlers_go18_test.go34
-rw-r--r--vendor/github.com/gorilla/handlers/handlers_pre18.go7
5 files changed, 65 insertions, 1 deletions
diff --git a/vendor/github.com/gorilla/handlers/README.md b/vendor/github.com/gorilla/handlers/README.md
index a782c4152..4a6895dcf 100644
--- a/vendor/github.com/gorilla/handlers/README.md
+++ b/vendor/github.com/gorilla/handlers/README.md
@@ -1,6 +1,8 @@
gorilla/handlers
================
[![GoDoc](https://godoc.org/github.com/gorilla/handlers?status.svg)](https://godoc.org/github.com/gorilla/handlers) [![Build Status](https://travis-ci.org/gorilla/handlers.svg?branch=master)](https://travis-ci.org/gorilla/handlers)
+[![Sourcegraph](https://sourcegraph.com/github.com/gorilla/handlers/-/badge.svg)](https://sourcegraph.com/github.com/gorilla/handlers?badge)
+
Package handlers is a collection of handlers (aka "HTTP middleware") for use
with Go's `net/http` package (or any framework supporting `http.Handler`), including:
diff --git a/vendor/github.com/gorilla/handlers/handlers.go b/vendor/github.com/gorilla/handlers/handlers.go
index 9544d2f0a..551f8ff05 100644
--- a/vendor/github.com/gorilla/handlers/handlers.go
+++ b/vendor/github.com/gorilla/handlers/handlers.go
@@ -94,7 +94,7 @@ func makeLogger(w http.ResponseWriter) loggingResponseWriter {
return logger
}
-type loggingResponseWriter interface {
+type commonLoggingResponseWriter interface {
http.ResponseWriter
http.Flusher
Status() int
diff --git a/vendor/github.com/gorilla/handlers/handlers_go18.go b/vendor/github.com/gorilla/handlers/handlers_go18.go
new file mode 100644
index 000000000..35eb8d4f5
--- /dev/null
+++ b/vendor/github.com/gorilla/handlers/handlers_go18.go
@@ -0,0 +1,21 @@
+// +build go1.8
+
+package handlers
+
+import (
+ "fmt"
+ "net/http"
+)
+
+type loggingResponseWriter interface {
+ commonLoggingResponseWriter
+ http.Pusher
+}
+
+func (l *responseLogger) Push(target string, opts *http.PushOptions) error {
+ p, ok := l.w.(http.Pusher)
+ if !ok {
+ return fmt.Errorf("responseLogger does not implement http.Pusher")
+ }
+ return p.Push(target, opts)
+}
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", "/"))
+}
diff --git a/vendor/github.com/gorilla/handlers/handlers_pre18.go b/vendor/github.com/gorilla/handlers/handlers_pre18.go
new file mode 100644
index 000000000..197836abb
--- /dev/null
+++ b/vendor/github.com/gorilla/handlers/handlers_pre18.go
@@ -0,0 +1,7 @@
+// +build !go1.8
+
+package handlers
+
+type loggingResponseWriter interface {
+ commonLoggingResponseWriter
+}