response

package
v0.0.0-...-b06ef97 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Wrap

Wrap returns a wrapped version of w that provides the exact same interface as w. Specifically if w implements any combination of http.Hijacker, http.Flusher, http.CloseNotifier or io.ReaderFrom, the wrapped version will implement the exact same combination. If no hooks are set, the wrapped version also behaves exactly as w. Hooks targeting methods not supported by w are ignored. Any other hooks will intercept the method they target and may modify the call's arguments and/or return values. The CaptureMetrics implementation serves as a working example for how the hooks can be used.

Types

type CloseNotifyFunc

type CloseNotifyFunc func() <-chan bool

CloseNotifyFunc is part of the http.CloseNotifier interface.

type FlushFunc

type FlushFunc func()

FlushFunc is part of the http.Flusher interface.

type HeaderFunc

type HeaderFunc func() http.Header

HeaderFunc is part of the http.ResponseWriter interface.

type HijackFunc

type HijackFunc func() (net.Conn, *bufio.ReadWriter, error)

HijackFunc is part of the http.Hijacker interface.

type Hooks

type Hooks struct {
	Header      func(HeaderFunc) HeaderFunc
	Write       func(WriteFunc) WriteFunc
	WriteHeader func(WriteHeaderFunc) WriteHeaderFunc
	Flush       func(FlushFunc) FlushFunc
	CloseNotify func(CloseNotifyFunc) CloseNotifyFunc
	ReadFrom    func(ReadFromFunc) ReadFromFunc
	Hijack      func(HijackFunc) HijackFunc
}

Hooks defines a set of method interceptors for methods included in http.ResponseWriter as well as some others. You can think of them as middleware for the function calls they target. See Wrap for more details.

type ReadFromFunc

type ReadFromFunc func(src io.Reader) (int64, error)

ReadFromFunc is part of the io.ReaderFrom interface.

type WriteFunc

type WriteFunc func([]byte) (int, error)

WriteFunc is part of the http.ResponseWriter interface.

type WriteHeaderFunc

type WriteHeaderFunc func(int)

WriteHeaderFunc is part of the http.ResponseWriter interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL