interceptors

package
v0.0.0-...-9146478 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BodyDump

func BodyDump(option Option, maxBodySizeBytes int) echo.MiddlewareFunc

BodyDump dump body for http request.

func CORS

func CORS(enable bool) echo.MiddlewareFunc

CORS .

func DetailLog

func DetailLog(option Option) echo.MiddlewareFunc

DetailLog print detail log for http request. Like: {"time":"2022-07-19T16:03:44.525493+08:00","id":"eSRLySVRiUAXs0VRu0AC0ETteIRKtAHg","remote_ip":"127.0.0.1","host":"localhost:9529","method":"GET","uri":"/test","user_agent":"curl/7.79.1","status":401,"error":"","latency":273532041,"latency_human":"273.532041ms","bytes_in":0,"bytes_out":25}

func GetRequestID

func GetRequestID(c echo.Context) string

GetRequestID get request id from context.

func InjectRequestID

func InjectRequestID() echo.MiddlewareFunc

InjectRequestID inject request id for http request.

func PassThroughDebugFlag

func PassThroughDebugFlag() echo.MiddlewareFunc

PassThroughDebugFlag is the middleware to pass through the debug flag.

func Recover

func Recover(log logs.Logger) interface{}

Recover .

func SimpleRecord

func SimpleRecord(option Option) echo.MiddlewareFunc

SimpleRecord record begin and end for http request.

Types

type EnableFetchFunc

type EnableFetchFunc func(c echo.Context) bool

EnableFetchFunc is a func used by middleware invoker to define how to get enable switch.

type Option

type Option struct {
	EnableFetchFuncs []EnableFetchFunc
	Log              logs.Logger
}

Option .

func NewOption

func NewOption(funcs []EnableFetchFunc, log logs.Logger) Option

NewOption .

Jump to

Keyboard shortcuts

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