Remove unnecessary comments
This commit is contained in:
parent
b2ead348e5
commit
7dbde25bcf
@ -6,29 +6,15 @@ import (
|
|||||||
"github.com/rs/cors"
|
"github.com/rs/cors"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CORSConfig defines the configuration options for CORS middleware
|
|
||||||
type CORSConfig struct {
|
type CORSConfig struct {
|
||||||
// AllowedOrigins defines the origins that are allowed to access the resource
|
|
||||||
AllowedOrigins []string
|
AllowedOrigins []string
|
||||||
|
|
||||||
// AllowedMethods defines the HTTP methods that are allowed
|
|
||||||
AllowedMethods []string
|
AllowedMethods []string
|
||||||
|
|
||||||
// AllowedHeaders defines the headers that are allowed in requests
|
|
||||||
AllowedHeaders []string
|
AllowedHeaders []string
|
||||||
|
|
||||||
// ExposedHeaders defines the headers that can be read by the browser
|
|
||||||
ExposedHeaders []string
|
ExposedHeaders []string
|
||||||
|
|
||||||
// AllowCredentials defines whether cookies, HTTP authentication and client SSL
|
|
||||||
// certificates can be transmitted in cross-origin requests
|
|
||||||
AllowCredentials bool
|
AllowCredentials bool
|
||||||
|
|
||||||
// MaxAge defines how long (in seconds) the results of a preflight request can be cached
|
|
||||||
MaxAge int
|
MaxAge int
|
||||||
}
|
}
|
||||||
|
|
||||||
// DefaultCORSConfig returns a default configuration for CORS middleware
|
|
||||||
func DefaultCORSConfig() CORSConfig {
|
func DefaultCORSConfig() CORSConfig {
|
||||||
return CORSConfig{
|
return CORSConfig{
|
||||||
AllowedOrigins: []string{},
|
AllowedOrigins: []string{},
|
||||||
|
@ -71,10 +71,6 @@ func CSRF(config CSRFConfig) Middleware {
|
|||||||
if config.Cookie.Domain != "" {
|
if config.Cookie.Domain != "" {
|
||||||
options = append(options, csrf.Domain(config.Cookie.Domain))
|
options = append(options, csrf.Domain(config.Cookie.Domain))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only check boolean fields if they've been explicitly set
|
|
||||||
// For cookie security settings, we only set them if they're being turned off
|
|
||||||
// since the secure defaults should be used otherwise
|
|
||||||
if !config.Cookie.Secure {
|
if !config.Cookie.Secure {
|
||||||
options = append(options, csrf.Secure(false))
|
options = append(options, csrf.Secure(false))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user