Define CORSMaxAgeSeconds constant

This commit is contained in:
2026-01-08 02:21:30 -08:00
parent ce25ea8f6f
commit 115f92660d

View File

@@ -18,6 +18,9 @@ import (
"sneak.berlin/go/pixa/internal/logger" "sneak.berlin/go/pixa/internal/logger"
) )
// CORSMaxAgeSeconds is the max age for CORS preflight cache (24 hours).
const CORSMaxAgeSeconds = 86400
// MiddlewareParams defines dependencies for Middleware. // MiddlewareParams defines dependencies for Middleware.
type MiddlewareParams struct { type MiddlewareParams struct {
fx.In fx.In
@@ -104,7 +107,7 @@ func (s *Middleware) CORS() func(http.Handler) http.Handler {
AllowedHeaders: []string{"Accept", "Authorization", "Content-Type"}, AllowedHeaders: []string{"Accept", "Authorization", "Content-Type"},
ExposedHeaders: []string{"Link"}, ExposedHeaders: []string{"Link"},
AllowCredentials: false, AllowCredentials: false,
MaxAge: 86400, MaxAge: CORSMaxAgeSeconds,
}) })
} }