cors

package
v0.0.0-...-82862be Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Default

func Default() wits.MiddlewareFunc

func New

func New(cors Cors) wits.MiddlewareFunc

Types

type Cors

type Cors struct {
	AllowAllOrigins  bool
	AllowOrigins     []string
	AllowMethods     []string
	AllowHeaders     []string
	ExposeHeaders    []string
	AllowCredentials bool
	MaxAge           time.Duration
}

Cors 跨域中间件,一般用于开发阶段 https://www.w3.org/TR/cors/

func DefaultConfig

func DefaultConfig() Cors

func (*Cors) AddAllowHeaders

func (cors *Cors) AddAllowHeaders(headers ...string)

func (*Cors) AddAllowMethods

func (cors *Cors) AddAllowMethods(methods ...string)

func (*Cors) AddAllowOrigins

func (cors *Cors) AddAllowOrigins(origin ...string)

func (*Cors) AddExposeHeaders

func (cors *Cors) AddExposeHeaders(headers ...string)

Jump to

Keyboard shortcuts

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