Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Root = &RootExpr{ APIOrigins: map[string]*OriginExpr{}, ServiceOrigins: map[string]*OriginExpr{}, }
Root is the design root expression.
Functions ¶
func PreflightPaths ¶
PreflightPaths returns the paths that should handle OPTIONS requests for the given service.
Types ¶
type OriginExpr ¶
type OriginExpr struct { // Origin is the origin string. Origin string // Methods is the list of authorized HTTP methods. Methods []string // Exposed is the list of headers exposed to clients. Exposed []string // Headers is the list of authorized headers, "*" authorizes all. Headers []string // MaxAge is the duration to cache a preflight request response. MaxAge uint // Credentials sets Access-Control-Allow-Credentials header in the // response. Credentials bool // Regexp tells whether the Origin string is a regular expression. Regexp bool // Parent expression, ServiceExpr or APIExpr. Parent eval.Expression }
OriginExpr describes a CORS policy.
func Origins ¶
func Origins(svc string) []*OriginExpr
Origins returns the origin expressions (sorted alphabetically by origin string) for the given service.
func (*OriginExpr) EvalName ¶
func (o *OriginExpr) EvalName() string
EvalName returns the generic expression name used in error messages.
func (*OriginExpr) Validate ¶
func (o *OriginExpr) Validate() *eval.ValidationErrors
Validate ensures the origin expression is valid.
type RootExpr ¶
type RootExpr struct { // APIOrigins lists all the CORS definitions indexed by origin string // at the API level. APIOrigins map[string]*OriginExpr // ServiceOrigins lists all the CORS definitions indexed by origin string // at the service level. ServiceOrigins map[string]*OriginExpr }
RootExpr keeps track of the CORS origins defined in the design.
Click to show internal directories.
Click to hide internal directories.