Documentation ¶
Index ¶
- Constants
- Variables
- type Codec
- type Context
- func (ctx *Context) BodyValue(name string) string
- func (ctx *Context) BodyValues(name string) []string
- func (ctx *Context) ContextValue(name string) interface{}
- func (ctx *Context) Decode(obj interface{}) error
- func (ctx *Context) Encode(obj interface{}, status int)
- func (ctx *Context) Env() *Env
- func (ctx *Context) Error(err error, statusCode int)
- func (ctx *Context) File(name string) *multipart.FileHeader
- func (ctx *Context) Files(name string) []*multipart.FileHeader
- func (ctx *Context) GetCodec() Codec
- func (ctx *Context) ParamValue(name string) string
- func (ctx *Context) QueryValue(name string) string
- func (ctx *Context) QueryValues(name string) []string
- func (ctx *Context) Render(name string, v interface{})
- func (ctx *Context) SetContextValue(name string, val interface{})
- func (ctx *Context) Status(code int)
- type Decoder
- type Encoder
- type Env
- type ErrType
- type ErrorHandler
- type Filter
- type FilterFunc
- type Handler
- type HandlerFunc
- type MatchedFilter
- type MatchedHandler
- type Params
- type Renderer
- type ResponseWriter
- type Router
- type Server
Constants ¶
const ( HeaderAccept = "Accept" HeaderAcceptEncoding = "Accept-Encoding" HeaderContentEncoding = "Content-Encoding" HeaderContentType = "Content-Type" HeaderContentLength = "Content-Length" HeaderUserAgent = "User-Agent" HeaderAuthorization = "Authorization" ContentEncodingGzip = "gzip" ContentEncodingDeflate = "deflate" HeaderOrigin = "Origin" // CORS HeaderCorsRequestMethod = "Access-Control-Request-Method" HeaderCorsRequestHeaders = "Access-Control-Request-Headers" HeaderCorsAllowOrigin = "Access-Control-Allow-Origin" HeaderCorsAllowCredentials = "Access-Control-Allow-Credentials" HeaderCorsAllowHeaders = "Access-Control-Allow-Headers" HeaderCorsAllowMethods = "Access-Control-Allow-Methods" HeaderCorsExposeHeaders = "Access-Control-Expose-Headers" HeaderCorsMaxAge = "Access-Control-Max-Age" )
const ( MethodGet = "GET" MethodPost = "POST" MethodDelete = "DELETE" MethodPut = "PUT" MethodPatch = "PATCH" MethodHead = "HEAD" MethodOptions = "OPTIONS" MethodConnect = "CONNECT" MethodTrace = "TRACE" )
Variables ¶
var ErrHijack = errors.New("response is not hijackable")
Functions ¶
This section is empty.
Types ¶
type Codec ¶
type Codec interface { ContentType() string Marshal(interface{}) ([]byte, error) NewEncoder(io.Writer) Encoder Encode(io.Writer, interface{}) error Unmarshal([]byte, interface{}) error NewDecoder(io.Reader) Decoder Decode(io.Reader, interface{}) error }
==============================================================================
Env
==============================================================================
type Context ¶
type Context struct { Req *http.Request Resp ResponseWriter Codec Codec // contains filtered or unexported fields }
==============================================================================
Context
==============================================================================
func (*Context) BodyValues ¶
func (*Context) ContextValue ¶
func (*Context) ParamValue ¶
func (*Context) QueryValue ¶
func (*Context) QueryValues ¶
func (*Context) SetContextValue ¶
type Decoder ¶
type Decoder interface {
Decode(interface{}) error
}
==============================================================================
Env
==============================================================================
type Encoder ¶
type Encoder interface {
Encode(interface{}) error
}
==============================================================================
Env
==============================================================================
type Env ¶
type Env struct { // cant't be nil Codec Codec Error ErrorHandler FileUpload struct { MaxMemory int64 } Renderer Renderer }
==============================================================================
Env
==============================================================================
type ErrType ¶
type ErrType uint8
==============================================================================
Env
==============================================================================
type ErrorHandler ¶
type ErrorHandler interface { Log(ctx *Context, errType ErrType, err error) Handle(ctx *Context, callerDepth, status int, err error) }
==============================================================================
Env
==============================================================================
type Filter ¶
==============================================================================
Handler
==============================================================================
type FilterFunc ¶
==============================================================================
Handler
==============================================================================
func (FilterFunc) Filter ¶
func (f FilterFunc) Filter(ctx *Context, chain Handler)
type Handler ¶
type Handler interface {
Handle(*Context)
}
==============================================================================
Handler
==============================================================================
type HandlerFunc ¶
type HandlerFunc func(*Context)
==============================================================================
Handler
==============================================================================
func (HandlerFunc) Handle ¶
func (f HandlerFunc) Handle(ctx *Context)
type MatchedFilter ¶
==============================================================================
Handler
==============================================================================
type MatchedHandler ¶
==============================================================================
Handler
==============================================================================
type Params ¶
==============================================================================
Context
==============================================================================
type Renderer ¶
==============================================================================
Env
==============================================================================
type ResponseWriter ¶
type ResponseWriter interface { StatusCode() int http.ResponseWriter }
==============================================================================
Context
==============================================================================
type Router ¶
type Router interface { Handle(path string, handler Handler) error Filter(path string, filters ...Filter) error Group(prefix string) Router Merge(prefix string, r Router) error MatchHandler(path string) MatchedHandler MatchFilters(path string) []MatchedFilter MatchHandlerAndFilters(path string) (MatchedHandler, []MatchedFilter) }
==============================================================================
Handler
==============================================================================