mux

package
v0.0.0-...-20fbe64 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2024 License: Apache-2.0 Imports: 4 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NotFoundHandler         = http.NotFound
	MethodNotAllowedHandler = MethodNotAllowed
)

Functions

func MethodNotAllowed

func MethodNotAllowed(w http.ResponseWriter, r *http.Request)

func PathVar

func PathVar(r *http.Request, key string) string

func PathVars

func PathVars(r *http.Request) map[string]string

Types

type MethodHandler

type MethodHandler map[string]http.Handler

func (MethodHandler) ServeHTTP

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

type MethodServeMux

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

func NewMethodServeMux

func NewMethodServeMux() *MethodServeMux

func (*MethodServeMux) Handle

func (mux *MethodServeMux) Handle(method, pattern string, handler http.Handler)

func (*MethodServeMux) HandleFunc

func (mux *MethodServeMux) HandleFunc(method, pattern string, handler func(w http.ResponseWriter, r *http.Request))

func (*MethodServeMux) ServeHTTP

func (mux *MethodServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request)

type ServeMux

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

ServeMux is a http.ServeMux like library,but support path variable for method match, see MethodServerMux

func NewServeMux

func NewServeMux() *ServeMux

func (*ServeMux) Handle

func (mux *ServeMux) Handle(pattern string, handler http.Handler)

func (*ServeMux) HandlerFunc

func (mux *ServeMux) HandlerFunc(pattern string, handler func(w http.ResponseWriter, r *http.Request))

func (*ServeMux) ServeHTTP

func (mux *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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