Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCORS ¶ added in v0.0.3
func NewCORS(options ...Option) httpx.Middleware
NewCORS creates an httpx middleware that applies configurable CORS headers. By default it allows all origins, standard HTTP verbs, and reflects requested headers.
Types ¶
type Option ¶ added in v0.0.3
type Option func(*config)
Option configures the behavior of the CORS middleware.
func WithAllowCredentials ¶ added in v0.0.3
WithAllowCredentials enables or disables the Access-Control-Allow-Credentials header.
func WithAllowHeaders ¶ added in v0.0.3
WithAllowHeaders sets the allowed request headers for preflight requests.
func WithAllowMethods ¶ added in v0.0.3
WithAllowMethods sets the HTTP methods that are allowed for CORS requests.
func WithAllowOrigins ¶ added in v0.0.3
WithAllowOrigins sets the list of allowed origins. Use "*" to allow any origin.
func WithExposeHeaders ¶ added in v0.0.3
WithExposeHeaders defines which headers are exposed to browser clients.
func WithMaxAge ¶ added in v0.0.3
WithMaxAge sets how long the results of a preflight request can be cached.