middleware

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BasicAuth

func BasicAuth(accounts map[string]string) gin.HandlerFunc

Authn returns a Basic HTTP Authorization middleware. It takes as argument a map[string]string where the key is the user name and the value is the password.

func Cors

func Cors(c *gin.Context)

Cors 是一个 Gin 中间件,用来设置 options 请求的返回头,然后退出中间件链,并结束请求(浏览器跨域设置).

func NoCache

func NoCache(c *gin.Context)

NoCache 是一个 Gin 中间件,用来禁止客户端缓存 HTTP 请求的返回结果.

func Secure

func Secure(c *gin.Context)

Secure 是一个 Gin 中间件,用来添加一些安全和资源访问相关的 HTTP 头.

func TraceID

func TraceID() gin.HandlerFunc

TraceID 是一个 Gin 中间件,用来在每一个 HTTP 请求的 context, response 中注入 `Trace-ID` 键值对.

Types

This section is empty.

Jump to

Keyboard shortcuts

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