Documentation
¶
Overview ¶
Package httpmux provides a router for the http package that supports method handling, sub routes, and route parameters stored in the http.Request's Context.
Index ¶
- Constants
- type ErrConsecutiveVars
- type ErrMethodNotAllowed
- type ErrOverlapStaticVar
- type ErrStatusHandler
- type ErrUnequalVars
- type Mux
- func (m *Mux) Handle(path string, handler http.Handler, methods ...string) *Route
- func (m *Mux) HandleFunc(path string, handlerFunc http.HandlerFunc, methods ...string) *Route
- func (m *Mux) Root() *Route
- func (m *Mux) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (m *Mux) SubRoute(path string) *Route
- type Route
- func (r *Route) Delete(handler http.Handler) *Route
- func (r *Route) DeleteFunc(handlerFunc http.HandlerFunc) *Route
- func (r *Route) Get(handler http.Handler) *Route
- func (r *Route) GetFunc(handlerFunc http.HandlerFunc) *Route
- func (r *Route) Handle(handler http.Handler, methods ...string) *Route
- func (r *Route) Patch(handler http.Handler) *Route
- func (r *Route) PatchFunc(handlerFunc http.HandlerFunc) *Route
- func (r *Route) Post(handler http.Handler) *Route
- func (r *Route) PostFunc(handlerFunc http.HandlerFunc) *Route
- func (r *Route) Put(handler http.Handler) *Route
- func (r *Route) PutFunc(handlerFunc http.HandlerFunc) *Route
- func (r *Route) SubRoute(path string) *Route
- type VarName
- type Variable
Constants ¶
View Source
const ( HeaderAllow = "Allow" ErrNotFound = ErrStatusHandler(http.StatusNotFound) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrConsecutiveVars ¶
func (*ErrConsecutiveVars) Error ¶
func (e *ErrConsecutiveVars) Error() string
type ErrMethodNotAllowed ¶
type ErrMethodNotAllowed []string
func (ErrMethodNotAllowed) Error ¶
func (_ ErrMethodNotAllowed) Error() string
func (ErrMethodNotAllowed) Header ¶
func (e ErrMethodNotAllowed) Header() string
type ErrOverlapStaticVar ¶
type ErrOverlapStaticVar VarName
func (ErrOverlapStaticVar) Error ¶
func (e ErrOverlapStaticVar) Error() string
type ErrStatusHandler ¶
type ErrStatusHandler int
func (ErrStatusHandler) Error ¶
func (h ErrStatusHandler) Error() string
func (ErrStatusHandler) ServeHTTP ¶
func (h ErrStatusHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type ErrUnequalVars ¶
func (*ErrUnequalVars) Error ¶
func (e *ErrUnequalVars) Error() string
type Mux ¶
type Mux struct {
AllowTrailingSlashes bool
DisallowSettingAllowMethodHeader bool
MethodNotAllowedHandler http.Handler
NotFoundHandler http.Handler
// contains filtered or unexported fields
}
func (*Mux) HandleFunc ¶
type Route ¶
type Route struct {
// contains filtered or unexported fields
}
func (*Route) DeleteFunc ¶
func (r *Route) DeleteFunc(handlerFunc http.HandlerFunc) *Route
type Variable ¶
func VariablesFrom ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.