middleware

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DELETE

DELETE only allow DELETE method

func GET

GET only allow GET method

HEAD only allow HEAD method

func MethodOnly

func MethodOnly(method string, h kate.ContextHandler) kate.ContextHandler

MethodOnly is a middleware to restrict http method for standard http router

func OPTIONS

OPTIONS only allow OPTIONS method

func PATCH

PATCH only allow PATCH method

func POST

POST only allow POST method

func PUT

PUT only allow PUT method

func Recovery

Recovery implements the recovery wrapper middleware

Types

type Chain

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

Chain is the middleware chain

func NewChain

func NewChain(middlewares ...Middleware) Chain

NewChain create a new middleware chain

func (Chain) Append

func (c Chain) Append(middlewares ...Middleware) Chain

Append return a new middleware chain with new middleware appended

func (Chain) Then

Then return a handler wrapped by the middleware chain

func (Chain) ThenFunc

ThenFunc return a handler wrapped by the middleware chain

type Middleware

type Middleware func(kate.ContextHandler) kate.ContextHandler

Middleware defines the middleware func

func Logging

func Logging(logger *zap.Logger) Middleware

Logging implements the request in/out logging middleware

Jump to

Keyboard shortcuts

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