From d103ed6ca97ca5a2669f6cf5fe4b3d2a9c945f26 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Wed, 17 May 2017 16:51:25 -0400 Subject: Upgrading server dependancies (#6431) --- vendor/github.com/gorilla/handlers/README.md | 2 ++ vendor/github.com/gorilla/handlers/handlers.go | 2 +- .../github.com/gorilla/handlers/handlers_go18.go | 21 +++++++++++++ .../gorilla/handlers/handlers_go18_test.go | 34 ++++++++++++++++++++++ .../github.com/gorilla/handlers/handlers_pre18.go | 7 +++++ 5 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 vendor/github.com/gorilla/handlers/handlers_go18.go create mode 100644 vendor/github.com/gorilla/handlers/handlers_go18_test.go create mode 100644 vendor/github.com/gorilla/handlers/handlers_pre18.go (limited to 'vendor/github.com/gorilla/handlers') 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 +} -- cgit v1.2.3-1-g7c22