{"modulePath":"github.com/ping-cloudnative/moonlight-utils","version":"v0.0.0-20220913084520-91464782bcde","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package interceptors\n\n## Functions\n\n```go\nfunc BodyDump(option Option, maxBodySizeBytes int) echo.MiddlewareFunc\n```\nBodyDump dump body for http request.\n\n```go\nfunc CORS(enable bool) echo.MiddlewareFunc\n```\nCORS .\n\n```go\nfunc DetailLog(option Option) echo.MiddlewareFunc\n```\nDetailLog 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}\n\n```go\nfunc GetRequestID(c echo.Context) string\n```\nGetRequestID get request id from context.\n\n```go\nfunc InjectRequestID() echo.MiddlewareFunc\n```\nInjectRequestID inject request id for http request.\n\n```go\nfunc PassThroughDebugFlag() echo.MiddlewareFunc\n```\nPassThroughDebugFlag is the middleware to pass through the debug flag.\n\n```go\nfunc Recover(log logs.Logger) interface{}\n```\nRecover .\n\n```go\nfunc SimpleRecord(option Option) echo.MiddlewareFunc\n```\nSimpleRecord record begin and end for http request.\n\n## Types\n\n```go\ntype EnableFetchFunc func(c echo.Context) bool\n```\nEnableFetchFunc is a func used by middleware invoker to define how to get enable switch.\n\n```go\ntype Option struct {\n\tEnableFetchFuncs []EnableFetchFunc\n\tLog              logs.Logger\n}\n```\nOption .\n\n```go\nfunc NewOption(funcs []EnableFetchFunc, log logs.Logger) Option\n```\nNewOption .\n\n","path":"github.com/ping-cloudnative/moonlight-utils/providers/httpserver/interceptors","name":"interceptors","synopsis":"","isRedistributable":true}
