cors

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: Apache-2.0 Imports: 6 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) Apply

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

func (*Config) Enable

func (config *Config) Enable(conf EnableConfig) *Config

Enable will configure the server to handle OPTIONS preflight requests according to your CORS configuration.

type ConfigFunc

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

func (*ConfigFunc) AllowAllOrigins

func (corsF *ConfigFunc) AllowAllOrigins() *ConfigFunc

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 (*ConfigFunc) AllowCredentials

func (corsF *ConfigFunc) AllowCredentials() *ConfigFunc

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 (*ConfigFunc) AllowHeaders

func (corsF *ConfigFunc) AllowHeaders(headers ...string) *ConfigFunc

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 (*ConfigFunc) AllowOrigins

func (corsF *ConfigFunc) AllowOrigins(origins ...string) *ConfigFunc

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

type EnableConfig

type EnableConfig func(config *ConfigFunc)

Jump to

Keyboard shortcuts

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