Documentation
¶
Index ¶
- type Body
- type LogFormatterParams
- type LoggerConfig
- type Middleware
- type Middlewares
- type MockHandler
- type MockMiddleware
- type Next
- type ResponseWriter
- type Router
- func (router *Router) Connect(pattern string, handler http.Handler)
- func (router *Router) ConnectFunc(pattern string, handlerFunc http.HandlerFunc)
- func (router *Router) Delete(pattern string, handler http.Handler)
- func (router *Router) DeleteFunc(pattern string, handlerFunc http.HandlerFunc)
- func (router *Router) Get(pattern string, handler http.Handler)
- func (router *Router) GetFunc(pattern string, handlerFunc http.HandlerFunc)
- func (router *Router) Handle(pattern string, handler http.Handler)
- func (router *Router) HandleFunc(pattern string, handlerFunc http.HandlerFunc)
- func (router *Router) HandleMethod(method, pattern string, handler http.Handler)
- func (router *Router) HandleMethodFunc(method, pattern string, handlerFunc http.HandlerFunc)
- func (router *Router) Head(pattern string, handler http.Handler)
- func (router *Router) HeadFunc(pattern string, handlerFunc http.HandlerFunc)
- func (router *Router) NotFound(handler http.Handler)
- func (router *Router) Options(pattern string, handler http.Handler)
- func (router *Router) OptionsFunc(pattern string, handlerFunc http.HandlerFunc)
- func (router *Router) Patch(pattern string, handler http.Handler)
- func (router *Router) PatchFunc(pattern string, handlerFunc http.HandlerFunc)
- func (router *Router) Post(pattern string, handler http.Handler)
- func (router *Router) PostFunc(pattern string, handlerFunc http.HandlerFunc)
- func (router *Router) Put(pattern string, handler http.Handler)
- func (router *Router) PutFunc(pattern string, handlerFunc http.HandlerFunc)
- func (router *Router) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (router *Router) Trace(pattern string, handler http.Handler)
- func (router *Router) TraceFunc(pattern string, handlerFunc http.HandlerFunc)
- func (router *Router) Use(middleware Middleware)
- type TestRoute
- type TestRouteParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LogFormatterParams ¶
type LogFormatterParams struct { Timestamp time.Time `json:"timestamp" yaml:"timestamp"` StatusCode int `json:"status_code" yaml:"status_code"` Latency time.Duration `json:"latency" yaml:"latency"` ClientIP string `json:"client_ip" yaml:"client_ip"` Method string `json:"method" yaml:"method"` Path string `json:"path" yaml:"path"` Query map[string][]string `json:"query" yaml:"query"` RequestContentType string `json:"request_content_type" yaml:"request_content_type"` RequestContentEncoding string `json:"request_content_encoding" yaml:"request_content_encoding"` ResponseContentType string `json:"response_content_type" yaml:"response_content_type"` ResponseContentEncoding string `json:"response_content_encoding" yaml:"response_content_encoding"` ProtocolVersion int `json:"protocol_version" yaml:"protocol_version"` }
func (LogFormatterParams) String ¶
func (l LogFormatterParams) String() string
type LoggerConfig ¶
type LoggerConfig struct { Output io.Writer LogFormatter func(LogFormatterParams) string }
type Middleware ¶
type Middleware func(http.ResponseWriter, *http.Request, Next)
func Logger ¶
func Logger(config LoggerConfig) Middleware
type Middlewares ¶
type Middlewares []Middleware
func (Middlewares) Append ¶
func (m Middlewares) Append(middleware Middleware) Middlewares
func (Middlewares) Chain ¶
func (m Middlewares) Chain(final http.HandlerFunc) http.HandlerFunc
type MockHandler ¶
func NewMockHandler ¶
func NewMockHandler(handler http.Handler) *MockHandler
func (*MockHandler) Handler ¶
func (mh *MockHandler) Handler() http.Handler
func (*MockHandler) ServeHTTP ¶
func (mh *MockHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request)
type MockMiddleware ¶
func NewMockMiddleware ¶
func NewMockMiddleware() *MockMiddleware
func (*MockMiddleware) Middleware ¶
func (mm *MockMiddleware) Middleware() Middleware
func (*MockMiddleware) Run ¶
func (mm *MockMiddleware) Run(rw http.ResponseWriter, r *http.Request, next Next)
type ResponseWriter ¶
type ResponseWriter struct { http.ResponseWriter StatusCode int }
func (*ResponseWriter) Flush ¶
func (rw *ResponseWriter) Flush()
func (*ResponseWriter) Hijack ¶
func (rw *ResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error)
func (*ResponseWriter) WriteHeader ¶
func (rw *ResponseWriter) WriteHeader(statusCode int)
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
func (*Router) ConnectFunc ¶
func (router *Router) ConnectFunc(pattern string, handlerFunc http.HandlerFunc)
func (*Router) DeleteFunc ¶
func (router *Router) DeleteFunc(pattern string, handlerFunc http.HandlerFunc)
func (*Router) GetFunc ¶
func (router *Router) GetFunc(pattern string, handlerFunc http.HandlerFunc)
func (*Router) HandleFunc ¶
func (router *Router) HandleFunc(pattern string, handlerFunc http.HandlerFunc)
func (*Router) HandleMethod ¶
func (*Router) HandleMethodFunc ¶
func (router *Router) HandleMethodFunc(method, pattern string, handlerFunc http.HandlerFunc)
func (*Router) HeadFunc ¶
func (router *Router) HeadFunc(pattern string, handlerFunc http.HandlerFunc)
func (*Router) OptionsFunc ¶
func (router *Router) OptionsFunc(pattern string, handlerFunc http.HandlerFunc)
func (*Router) PatchFunc ¶
func (router *Router) PatchFunc(pattern string, handlerFunc http.HandlerFunc)
func (*Router) PostFunc ¶
func (router *Router) PostFunc(pattern string, handlerFunc http.HandlerFunc)
func (*Router) PutFunc ¶
func (router *Router) PutFunc(pattern string, handlerFunc http.HandlerFunc)
func (*Router) TraceFunc ¶
func (router *Router) TraceFunc(pattern string, handlerFunc http.HandlerFunc)
func (*Router) Use ¶
func (router *Router) Use(middleware Middleware)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.