Documentation
¶
Overview ¶
Package middleware 包含了一系列 http.Handler 接口的中间件
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Handler ¶
func Handler(h http.Handler, middleware ...Middleware) http.Handler
Handler 按顺序将所有的中间件应用于 h
func HandlerFunc ¶
func HandlerFunc(h func(w http.ResponseWriter, r *http.Request), middleware ...Middleware) http.Handler
HandlerFunc 按顺序将所有的中间件应用于 h
Types ¶
Directories
¶
Path | Synopsis |
---|---|
Package auth 验证类的中间件
|
Package auth 验证类的中间件 |
basic
Package basic 实现 Basic 校验 https://tools.ietf.org/html/rfc7617
|
Package basic 实现 Basic 校验 https://tools.ietf.org/html/rfc7617 |
Package compress 提供一个支持内容压缩的中间件
|
Package compress 提供一个支持内容压缩的中间件 |
Package debugger 提供测试和性能测试相关的中间件
|
Package debugger 提供测试和性能测试相关的中间件 |
Package errorhandler 提供自定义错误页面的功能
|
Package errorhandler 提供自定义错误页面的功能 |
Package header 用于指定输出的报头
|
Package header 用于指定输出的报头 |
Package health API 状态检测
|
Package health API 状态检测 |
Package host 提供了限定访问域名的中间件
|
Package host 提供了限定访问域名的中间件 |
Package ratelimit 提供了 X-Rate-Limit 功能的中间件 X-Rate-Limit-Limit: 同一个时间段所允许的请求的最大数目; X-Rate-Limit-Remaining: 在当前时间段内剩余的请求的数量; X-Rate-Limit-Reset: 为了得到最大请求数所等待的秒数。
|
Package ratelimit 提供了 X-Rate-Limit 功能的中间件 X-Rate-Limit-Limit: 同一个时间段所允许的请求的最大数目; X-Rate-Limit-Remaining: 在当前时间段内剩余的请求的数量; X-Rate-Limit-Reset: 为了得到最大请求数所等待的秒数。 |
Package recovery 提供了处理 panic 操作的中间件 recovery.RecoverFunc(func(w http.ResponseWriter, msg interface{}) { fmt.Printf("recovery: %s", msg) }).MiddlewareFunc(func(w http.ResponseWriter, r *http.Request){ panic("panic") })
|
Package recovery 提供了处理 panic 操作的中间件 recovery.RecoverFunc(func(w http.ResponseWriter, msg interface{}) { fmt.Printf("recovery: %s", msg) }).MiddlewareFunc(func(w http.ResponseWriter, r *http.Request){ panic("panic") }) |
Package version 提供一个限定版本号的中间件
|
Package version 提供一个限定版本号的中间件 |
Click to show internal directories.
Click to hide internal directories.