aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/felixge/httpsnoop/wrap_generated_lt_1.8.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/felixge/httpsnoop/wrap_generated_lt_1.8.go')
-rw-r--r--vendor/github.com/felixge/httpsnoop/wrap_generated_lt_1.8.go67
1 files changed, 51 insertions, 16 deletions
diff --git a/vendor/github.com/felixge/httpsnoop/wrap_generated_lt_1.8.go b/vendor/github.com/felixge/httpsnoop/wrap_generated_lt_1.8.go
index 36bb59b83..ab99c07c7 100644
--- a/vendor/github.com/felixge/httpsnoop/wrap_generated_lt_1.8.go
+++ b/vendor/github.com/felixge/httpsnoop/wrap_generated_lt_1.8.go
@@ -68,115 +68,131 @@ func Wrap(w http.ResponseWriter, hooks Hooks) http.ResponseWriter {
// combination 1/16
case !i0 && !i1 && !i2 && !i3:
return struct {
+ Unwrapper
http.ResponseWriter
- }{rw}
+ }{rw, rw}
// combination 2/16
case !i0 && !i1 && !i2 && i3:
return struct {
+ Unwrapper
http.ResponseWriter
io.ReaderFrom
- }{rw, rw}
+ }{rw, rw, rw}
// combination 3/16
case !i0 && !i1 && i2 && !i3:
return struct {
+ Unwrapper
http.ResponseWriter
http.Hijacker
- }{rw, rw}
+ }{rw, rw, rw}
// combination 4/16
case !i0 && !i1 && i2 && i3:
return struct {
+ Unwrapper
http.ResponseWriter
http.Hijacker
io.ReaderFrom
- }{rw, rw, rw}
+ }{rw, rw, rw, rw}
// combination 5/16
case !i0 && i1 && !i2 && !i3:
return struct {
+ Unwrapper
http.ResponseWriter
http.CloseNotifier
- }{rw, rw}
+ }{rw, rw, rw}
// combination 6/16
case !i0 && i1 && !i2 && i3:
return struct {
+ Unwrapper
http.ResponseWriter
http.CloseNotifier
io.ReaderFrom
- }{rw, rw, rw}
+ }{rw, rw, rw, rw}
// combination 7/16
case !i0 && i1 && i2 && !i3:
return struct {
+ Unwrapper
http.ResponseWriter
http.CloseNotifier
http.Hijacker
- }{rw, rw, rw}
+ }{rw, rw, rw, rw}
// combination 8/16
case !i0 && i1 && i2 && i3:
return struct {
+ Unwrapper
http.ResponseWriter
http.CloseNotifier
http.Hijacker
io.ReaderFrom
- }{rw, rw, rw, rw}
+ }{rw, rw, rw, rw, rw}
// combination 9/16
case i0 && !i1 && !i2 && !i3:
return struct {
+ Unwrapper
http.ResponseWriter
http.Flusher
- }{rw, rw}
+ }{rw, rw, rw}
// combination 10/16
case i0 && !i1 && !i2 && i3:
return struct {
+ Unwrapper
http.ResponseWriter
http.Flusher
io.ReaderFrom
- }{rw, rw, rw}
+ }{rw, rw, rw, rw}
// combination 11/16
case i0 && !i1 && i2 && !i3:
return struct {
+ Unwrapper
http.ResponseWriter
http.Flusher
http.Hijacker
- }{rw, rw, rw}
+ }{rw, rw, rw, rw}
// combination 12/16
case i0 && !i1 && i2 && i3:
return struct {
+ Unwrapper
http.ResponseWriter
http.Flusher
http.Hijacker
io.ReaderFrom
- }{rw, rw, rw, rw}
+ }{rw, rw, rw, rw, rw}
// combination 13/16
case i0 && i1 && !i2 && !i3:
return struct {
+ Unwrapper
http.ResponseWriter
http.Flusher
http.CloseNotifier
- }{rw, rw, rw}
+ }{rw, rw, rw, rw}
// combination 14/16
case i0 && i1 && !i2 && i3:
return struct {
+ Unwrapper
http.ResponseWriter
http.Flusher
http.CloseNotifier
io.ReaderFrom
- }{rw, rw, rw, rw}
+ }{rw, rw, rw, rw, rw}
// combination 15/16
case i0 && i1 && i2 && !i3:
return struct {
+ Unwrapper
http.ResponseWriter
http.Flusher
http.CloseNotifier
http.Hijacker
- }{rw, rw, rw, rw}
+ }{rw, rw, rw, rw, rw}
// combination 16/16
case i0 && i1 && i2 && i3:
return struct {
+ Unwrapper
http.ResponseWriter
http.Flusher
http.CloseNotifier
http.Hijacker
io.ReaderFrom
- }{rw, rw, rw, rw, rw}
+ }{rw, rw, rw, rw, rw, rw}
}
panic("unreachable")
}
@@ -186,6 +202,10 @@ type rw struct {
h Hooks
}
+func (w *rw) Unwrap() http.ResponseWriter {
+ return w.w
+}
+
func (w *rw) Header() http.Header {
f := w.w.(http.ResponseWriter).Header
if w.h.Header != nil {
@@ -241,3 +261,18 @@ func (w *rw) ReadFrom(src io.Reader) (int64, error) {
}
return f(src)
}
+
+type Unwrapper interface {
+ Unwrap() http.ResponseWriter
+}
+
+// Unwrap returns the underlying http.ResponseWriter from within zero or more
+// layers of httpsnoop wrappers.
+func Unwrap(w http.ResponseWriter) http.ResponseWriter {
+ if rw, ok := w.(Unwrapper); ok {
+ // recurse until rw.Unwrap() returns a non-Unwrapper
+ return Unwrap(rw.Unwrap())
+ } else {
+ return w
+ }
+}