cors

package
v1.0.1-beta Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cors

func Cors(option Option) gin.HandlerFunc

Cors adds Cross-Origin Resource Sharing headers support in your Gin application

Types

type Option

type Option struct {

	// Matches the request origin
	Origin []string `yaml:"origin"`

	// Matches the request method
	Method []string `yaml:"method"`

	// Sets the Access-Control-Allow-Headers response header
	AllowHeader []string `yaml:"allow_header"`

	// Sets the Access-Control-Expose-Headers response header
	ExposedHeader []string `yaml:"exposed_header"`

	// Sets the Access-Control-Max-Age response header
	MaxAge int `yaml:"max_age"`

	// Sets the Access-Control-Allow-Credentials header
	Credentials bool `yaml:"credentials"`
}

Jump to

Keyboard shortcuts

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