cors

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configs

type Configs struct {
	Enabled          bool
	AllowOrigin      string
	AllowMethods     string
	AllowHeaders     string
	PreflightMaxAge  int64
	AllowCredentials bool
	ExposeHeaders    string
}

func DefaultCORSConfigs

func DefaultCORSConfigs() *Configs

func (*Configs) AddCORSHeaders

func (c *Configs) AddCORSHeaders(r *http.Request, resp *http.Response)

Add CORS headers to the response if the request contains Origin header

func (*Configs) InterceptPreflightRequest

func (c *Configs) InterceptPreflightRequest(r *http.Request) *http.Response

TODO provide config to pass through OPTIONS call Intercept pre-flight request and return 200 response with CORS headers

Jump to

Keyboard shortcuts

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