middleware

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const TimeFormat = "2006-01-02 15:04:05"

Variables

This section is empty.

Functions

func AccessCors

func AccessCors(cors *Cors) gin.HandlerFunc

func GinZapLogger

func GinZapLogger() gin.HandlerFunc

使用zao.logger的中间件

func RecoverWithZapLogger

func RecoverWithZapLogger(stack bool) gin.HandlerFunc

Panic恢复的中间件

Types

type Cors

type Cors struct {
	Origin      string
	Headers     string
	Credentials string
	Methods     string
	Types       string
}

func DefaultCors

func DefaultCors() *Cors

func NewCors

func NewCors(ops ...Option) *Cors

type Option

type Option func(*Cors)

func WithCredentials

func WithCredentials(credentials string) Option

设置为true,允许ajax异步请求带cookie信息

func WithHeaders

func WithHeaders(headers ...string) Option

header的类型

func WithMethods

func WithMethods(methods ...string) Option

允许请求方法

func WithOrigin

func WithOrigin(urls ...string) Option

允许的域

func WithTypes

func WithTypes(typ string) Option

返回数据格式

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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