Documentation ¶
Index ¶
- func NewMatchContext(cxt context.Context, match *Match) context.Context
- type Attributes
- type Context
- type Handler
- type Match
- type Matcher
- type Middle
- type MiddleFunc
- type Middles
- 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
- func (r *Route) Use(m ...Middle) *Route
- 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 ¶
func (a Attributes) Copy() Attributes
func (Attributes) String ¶
func (a Attributes) String() string
type MiddleFunc ¶
Middle function wrapper
func (MiddleFunc) Wrap ¶
func (m MiddleFunc) Wrap(h Handler) Handler
MiddleFunc conforms to Middle by calling itself with the handler
type Request ¶
func (*Request) OriginAddr ¶
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
func (Route) Matches ¶
Matches the provided request or not; returns the details of the match if successful, otherwise nil.
Click to show internal directories.
Click to hide internal directories.