method

package
v0.4.9 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = fmt.Errorf("error not found")
)

Functions

func NewMethodWithConfig

func NewMethodWithConfig(conf *Config) (http.Handler, error)

Types

type Config

type Config struct {
	Methods  []*Route
	NotFound http.Handler
}

type Method

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

Method is an host multiplexer.

func NewMethod

func NewMethod() *Method

func (*Method) Handle

func (h *Method) Handle(host string, handler http.Handler) error

func (*Method) Handler

func (h *Method) Handler(host string) (handler http.Handler, err error)

Handler returns method route handler.

func (*Method) NotFound

func (h *Method) NotFound(handler http.Handler) error

func (*Method) ServeHTTP

func (h *Method) ServeHTTP(rw http.ResponseWriter, r *http.Request)

type MethodEnum

type MethodEnum string
const (
	MethodGet     MethodEnum = "GET"
	MethodHead    MethodEnum = "HEAD"
	MethodPost    MethodEnum = "POST"
	MethodPut     MethodEnum = "PUT"
	MethodPatch   MethodEnum = "PATCH"
	MethodDelete  MethodEnum = "DELETE"
	MethodConnect MethodEnum = "CONNECT"
	MethodOptions MethodEnum = "OPTIONS"
	MethodTrace   MethodEnum = "TRACE"
)

type Route

type Route struct {
	Method  MethodEnum
	Handler http.Handler
}

Jump to

Keyboard shortcuts

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