cors

package
v0.3.60 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CORS

type CORS struct {
	CacheDuration   time.Duration
	Origins         []string
	RequestHeaders  string
	ResponseHeaders string
}

CORS handles details for Cross-Origin Resource Sharing. See https://www.w3.org/TR/cors/

func (CORS) AddCORSHeaders

func (c CORS) AddCORSHeaders(r *http.Request, w http.ResponseWriter)

func (CORS) AddCORSHeadersOrigin

func (c CORS) AddCORSHeadersOrigin(origin string, headers http.Header)

func (CORS) AddCORSHeadersTo

func (c CORS) AddCORSHeadersTo(reqHeaders http.Header, respHeaders http.Header)

func (CORS) Handle

func (c CORS) Handle(w http.ResponseWriter, r *http.Request) bool

Handle returns true if the request is entirely handled (i.e. is a CORS options request), and false if further handling needs to continue.

func (CORS) HandlePreflight

func (c CORS) HandlePreflight(w http.ResponseWriter, r *http.Request)

func (CORS) Preflight

func (c CORS) Preflight() http.Handler

func (CORS) Wrap

func (c CORS) Wrap(h http.Handler) http.Handler

Jump to

Keyboard shortcuts

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