interceptors

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: Apache-2.0 Imports: 8 Imported by: 19

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BodyDump added in v1.0.8

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 added in v1.0.8

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 added in v1.0.8

func GetRequestID(c echo.Context) string

GetRequestID get request id from context.

func InjectRequestID added in v1.0.8

func InjectRequestID() echo.MiddlewareFunc

InjectRequestID inject request id for http request.

func PassThroughDebugFlag added in v1.0.8

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 added in v1.0.8

func SimpleRecord(option Option) echo.MiddlewareFunc

SimpleRecord record begin and end for http request.

Types

type EnableFetchFunc added in v1.0.8

type EnableFetchFunc func(c echo.Context) bool

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

type Option added in v1.0.8

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

Option .

func NewOption added in v1.0.8

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