Remove unnecessary comments

This commit is contained in:
Christian Galo 2025-04-29 02:45:56 -05:00
parent b2ead348e5
commit 7dbde25bcf
2 changed files with 5 additions and 23 deletions

View File

@ -6,29 +6,15 @@ import (
"github.com/rs/cors"
)
// CORSConfig defines the configuration options for CORS middleware
type CORSConfig struct {
// AllowedOrigins defines the origins that are allowed to access the resource
AllowedOrigins []string
// AllowedMethods defines the HTTP methods that are allowed
AllowedMethods []string
// AllowedHeaders defines the headers that are allowed in requests
AllowedHeaders []string
// ExposedHeaders defines the headers that can be read by the browser
ExposedHeaders []string
// AllowCredentials defines whether cookies, HTTP authentication and client SSL
// certificates can be transmitted in cross-origin requests
AllowedOrigins []string
AllowedMethods []string
AllowedHeaders []string
ExposedHeaders []string
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 {
return CORSConfig{
AllowedOrigins: []string{},

View File

@ -71,10 +71,6 @@ func CSRF(config CSRFConfig) Middleware {
if 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 {
options = append(options, csrf.Secure(false))
}