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