httpmux

package module
v0.0.0-...-a185308 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2017 License: MIT Imports: 6 Imported by: 0

README

httpmux

Provides a router for the http package that supports method handling, sub routes, and route parameters.

Documentation and Examples

Full documentation and examples can be found at GoDoc

Status

Coverage Status Build Status

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

View Source
const (
	HeaderAllow = "Allow"

	ErrNotFound = ErrStatusHandler(http.StatusNotFound)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrConsecutiveVars

type ErrConsecutiveVars struct {
	Variable1 VarName
	Variable2 VarName
}

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

type ErrUnequalVars struct {
	Variable1 VarName
	Variable2 VarName
}

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 New

func New() *Mux

func (*Mux) Handle

func (m *Mux) Handle(path string, handler http.Handler, methods ...string) *Route

func (*Mux) HandleFunc

func (m *Mux) HandleFunc(path string, handlerFunc http.HandlerFunc, methods ...string) *Route

func (*Mux) Root

func (m *Mux) Root() *Route

func (*Mux) ServeHTTP

func (m *Mux) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Mux) SubRoute

func (m *Mux) SubRoute(path string) *Route

type Route

type Route struct {
	// contains filtered or unexported fields
}

func (*Route) Delete

func (r *Route) Delete(handler http.Handler) *Route

func (*Route) DeleteFunc

func (r *Route) DeleteFunc(handlerFunc http.HandlerFunc) *Route

func (*Route) Get

func (r *Route) Get(handler http.Handler) *Route

func (*Route) GetFunc

func (r *Route) GetFunc(handlerFunc http.HandlerFunc) *Route

func (*Route) Handle

func (r *Route) Handle(handler http.Handler, methods ...string) *Route

func (*Route) Patch

func (r *Route) Patch(handler http.Handler) *Route

func (*Route) PatchFunc

func (r *Route) PatchFunc(handlerFunc http.HandlerFunc) *Route

func (*Route) Post

func (r *Route) Post(handler http.Handler) *Route

func (*Route) PostFunc

func (r *Route) PostFunc(handlerFunc http.HandlerFunc) *Route

func (*Route) Put

func (r *Route) Put(handler http.Handler) *Route

func (*Route) PutFunc

func (r *Route) PutFunc(handlerFunc http.HandlerFunc) *Route

func (*Route) SubRoute

func (r *Route) SubRoute(path string) *Route

type VarName

type VarName string

type Variable

type Variable struct {
	Name  VarName
	Value string
}

func VariableFrom

func VariableFrom(c context.Context, name string) *Variable

func VariableFromOk

func VariableFromOk(c context.Context, name string) (*Variable, bool)

func VariablesFrom

func VariablesFrom(c context.Context) []*Variable

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL