cors

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

func New

func New() *Config

func (*Config) AllowAllOrigins added in v0.2.0

func (config *Config) AllowAllOrigins() *Config

AllowAllOrigins will explicitly set allowed origins to "*", allowing all origins.

For more details see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin

func (*Config) AllowCredentials added in v0.2.0

func (config *Config) AllowCredentials(allow bool) *Config

AllowCredentials will allow for the user to send credentials using cross origin requests

For more details see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials

func (*Config) AllowHeaders added in v0.2.0

func (config *Config) AllowHeaders(headers ...string) *Config

AllowHeaders sets the allowed headers for CORS in addition to the safelisted headers found in https://developer.mozilla.org/en-US/docs/Glossary/CORS-safelisted_request_header. Defaults to "*"

For more details see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers

func (*Config) AllowMethods added in v0.2.0

func (config *Config) AllowMethods(methods ...string) *Config

AllowMethods sets the allowed methods for CORS. Defaults to GET, POST, PUT, DELETE, OPTIONS.

func (*Config) AllowOrigins added in v0.2.0

func (config *Config) AllowOrigins(origins ...string) *Config

AllowOrigins sets the allowed origins for cross origin requests

For more details see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin

func (*Config) Apply

func (config *Config) Apply(app *govalin.App)

func (*Config) Name added in v0.1.3

func (config *Config) Name() string

func (*Config) OnInit added in v0.1.3

func (config *Config) OnInit(_ *govalin.Config)

Jump to

Keyboard shortcuts

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