http_middleware

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2020 License: MIT Imports: 16 Imported by: 1

Documentation

Index

Constants

View Source
const HTTPRequestStartTime = "httpRequestStartTime"
View Source
const IsLogHTTPResponse = "isLogHttpResponse"
View Source
const IsNoLogHTTPRequest = "isNoLogHttpRequest"
View Source
const MaxLogMessageLength = 32766

Variables

This section is empty.

Functions

func AddCrossOriginHeaders

func AddCrossOriginHeaders() gin.HandlerFunc

允许跨域响应头中间件

func Favicon

func Favicon(path string) gin.HandlerFunc

func HandleOptionsMethod

func HandleOptionsMethod() gin.HandlerFunc

HTTP OPTIONS、HEAD 方法直接响应成功中间件

func Logger

func Logger(hostPrefix string, logger *logger.Logger, notLogged ...string) gin.HandlerFunc

日志中间件

func NoReqLogger

func NoReqLogger() gin.HandlerFunc

记录http响应结果

func Recovery

func Recovery(hostPrefix string, logger *logger.Logger) gin.HandlerFunc

Recovery中间件(统一错误处理)

func RespLogger

func RespLogger() gin.HandlerFunc

记录http响应结果

Types

type PrefixCut

type PrefixCut struct {
	Handler    http.Handler
	HostPrefix string
}

请求前缀剪裁中间件(底层http.Handler接口织入,非Gin中间件)

func (*PrefixCut) ServeHTTP

func (cut *PrefixCut) ServeHTTP(writer http.ResponseWriter, request *http.Request)

Jump to

Keyboard shortcuts

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