tools

package
v1.0.21 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2021 License: MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultAllowHeaders = []string{"authorization", "token", "content-type", "x-requested-with"}
	DefaultAllowMethods = []string{http.MethodPost, http.MethodGet, http.MethodPut, http.MethodDelete, http.MethodOptions, http.MethodPatch}
)

Functions

func Cors

func Cors(c *gin.Context, config *CorsConfig)

Cors 自己尝试的cors配置实现

func DefaultCors

func DefaultCors(c *gin.Context)

func RandStringBytes

func RandStringBytes(n int) string

RandStringBytes 随机字符串

func UUID

func UUID() (_uuid string, err error)

UUID UUID

Types

type CorsConfig

type CorsConfig struct {
	AllowOrigins     []string
	AllowAnyOrigin   bool
	AllowMethods     []string
	AllowHeaders     []string
	AllowCredentials bool
}

func DefaultCorsConfig

func DefaultCorsConfig() *CorsConfig

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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