Documentation
¶
Index ¶
- func NewMatchContext(cxt context.Context, match *Match) context.Context
- type Attributes
- type Context
- type Handler
- type Match
- type Matcher
- type Middleware
- type MiddlewareFunc
- type Request
- type Response
- func (r *Response) ReadEntity() ([]byte, error)
- func (r *Response) SetBytes(t string, d []byte) (*Response, error)
- func (r *Response) SetEntity(e entity.Entity) (*Response, error)
- func (r *Response) SetHeader(k, v string) *Response
- func (r *Response) SetJSON(d interface{}) (*Response, error)
- func (r *Response) SetString(t, d string) (*Response, error)
- type Route
- func (r *Route) Attr(k string, v interface{}) *Route
- func (r *Route) Context(match *Match) Context
- func (r *Route) Describe(verbose bool) string
- func (r *Route) Handle(req *Request, cxt Context) (*Response, error)
- func (r *Route) Match(m Matcher) *Route
- func (r Route) Matches(req *Request, state *matchState) *Match
- func (r *Route) Methods(m ...string) *Route
- func (r *Route) Param(k, v string) *Route
- func (r *Route) Params(p url.Values) *Route
- func (r *Route) Paths(s ...string) *Route
- func (r *Route) String() string
- type Router
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Attributes ¶
type Attributes map[string]interface{}
Request attributes
func (Attributes) Copy ¶ added in v1.0.1
func (a Attributes) Copy() Attributes
type Middleware ¶
Middleware provides functionality to wrap a handler producing another handler
type MiddlewareFunc ¶ added in v1.4.0
Middleware function wrapper
func (MiddlewareFunc) Wrap ¶ added in v1.4.0
func (m MiddlewareFunc) Wrap(h Handler) Handler
type Request ¶
func (*Request) OriginAddr ¶ added in v1.8.0
OriginAddr tries to identify the best address possible representing the origination of the request.
When available it prefers the `X-Forwarded-For` header, which is widely used by middleware infrastructure for this purpose. Failing that, the http.Request.RemotAddr is used with the port portion of the value removed.
If none of the above is available and empty string is returned.
type Response ¶
type Response struct { Status int Header http.Header Entity io.ReadCloser }
func NewResponse ¶
func (*Response) ReadEntity ¶
type Route ¶
type Route struct {
// contains filtered or unexported fields
}
An individual route
Click to show internal directories.
Click to hide internal directories.