cors

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultPreFilter

func DefaultPreFilter() *web.Prefilter

func PreFilter

func PreFilter(options Options) *web.Prefilter

cors must be handled before routing

Types

type Cors

type Cors struct {
	Log Logger
	// contains filtered or unexported fields
}

func New

func New(options Options) *Cors

func (*Cors) OriginAllowed

func (c *Cors) OriginAllowed(r *http.Request) bool

check the Origin of a request. No origin at all is also allowed.

type Logger

type Logger interface {
	Printf(string, ...interface{})
}

type Options

type Options struct {
	AllowedOrigins         []string
	AllowOriginFunc        func(origin string) bool
	AllowOriginRequestFunc func(r *http.Request, origin string) bool
	AllowedMethods         []string
	AllowedHeaders         []string
	ExposedHeaders         []string
	MaxAge                 int
	AllowCredentials       bool
	AllowPrivateNetwork    bool
	OptionsPassthrough     bool
	OptionsSuccessStatus   int
	Debug                  bool
}

Jump to

Keyboard shortcuts

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