interceptor

package
v0.0.60 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Word   = ":word"
	Number = ":number"
	Any    = ":any"
)
View Source
const (
	BrowserCacheLifeTimeWeek = 604800 // week 7 days
)
View Source
const (
	EncodingCharsetUTF8 = "utf-8"
)
View Source
const MaxFormSizeMemory = 10 << 20

Variables

This section is empty.

Functions

func Predefined added in v0.0.9

func Predefined() map[string]string

Types

type FileData added in v0.0.15

type FileData struct {
	Name     string
	Size     int64
	Data     []byte
	Download bool
}

type HTTPAnswer added in v0.0.9

type HTTPAnswer struct {
	// Configure
	//--------------------------
	GZipped                  bool
	BrowserCached            bool
	ETagUsed                 bool
	GZipLevel                int // gzip.BestCompression
	BrowserCacheLifeTime     int
	Encoding                 string
	AccessControlAllowOrigin string

	// Data
	//--------------------------
	ResponseCode int
	Content      interface{}
	ContentType  string
	ETag         string
}

func (*HTTPAnswer) Send added in v0.0.9

func (answer *HTTPAnswer) Send(w http.ResponseWriter, r *http.Request) error

type HTTPRegexp added in v0.0.9

type HTTPRegexp struct {
	List map[string]*regexp.Regexp
}

Регулярные выражения для проверки роутов

func (*HTTPRegexp) Add added in v0.0.9

func (reg *HTTPRegexp) Add(pattern, regExpPattern string)

func (*HTTPRegexp) AddPredefined added in v0.0.9

func (reg *HTTPRegexp) AddPredefined(predefined []string)

func (*HTTPRegexp) Init added in v0.0.9

func (reg *HTTPRegexp) Init()

func (*HTTPRegexp) MatchURIParts added in v0.0.9

func (reg *HTTPRegexp) MatchURIParts(routeURIParts, requestURLParts []string) bool

type HTTPRoute added in v0.0.9

type HTTPRoute struct {
	Method string
	URI    string
	F      HandlerFunc
}

Один Роут и методы его сравнения

func (*HTTPRoute) MatchMethod added in v0.0.9

func (route *HTTPRoute) MatchMethod(r *http.Request) bool

func (*HTTPRoute) MatchURI added in v0.0.9

func (route *HTTPRoute) MatchURI(r *http.Request, regexp HTTPRegexp) bool

type HTTPRouter added in v0.0.9

type HTTPRouter struct {
	Logger                *zap.Logger
	Routes                []HTTPRoute
	DefaultNotFoundAnswer HTTPAnswer
	HTTPRegexp
}

func (*HTTPRouter) HandleFunc added in v0.0.9

func (router *HTTPRouter) HandleFunc(method, uri string, f HandlerFunc)

func (*HTTPRouter) Init added in v0.0.9

func (router *HTTPRouter) Init()

func (*HTTPRouter) ServeHTTP added in v0.0.9

func (router *HTTPRouter) ServeHTTP(w http.ResponseWriter, r *http.Request)

type HandlerFunc added in v0.0.39

type HandlerFunc func(http.ResponseWriter, *http.Request) error

type UploadedFile added in v0.0.37

type UploadedFile struct {
	Name string
	Size int64
	Mime string
	Data []byte
}

func GetFile added in v0.0.37

func GetFile(key string, r *http.Request) (upFile *UploadedFile, err error)

Jump to

Keyboard shortcuts

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