Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ServicesData = make(map[string]*ServiceData)
ServicesData holds the all the ServiceData indexed by service name.
Functions ¶
func Generate ¶
Generate produces server code that handle preflight requests and updates the HTTP responses with the appropriate CORS headers.
func MatchOrigin ¶
MatchOrigin returns true if the given Origin header value matches the origin specification. Spec can be one of: - a plain string identifying an origin. eg http://swagger.goa.design - a plain string containing a wildcard. eg *.goa.design - the special string * that matches every host
Types ¶
type ServiceData ¶
type ServiceData struct { // Name is the name of the service. Name string // Origins is a list of origin expressions defined in API and service levels. Origins []*expr.OriginExpr // OriginHandler is the name of the handler function that sets CORS headers. OriginHandler string // PreflightPaths is the list of paths that should handle OPTIONS requests. PreflightPaths []string // Endpoint is the CORS endpoint data. Endpoint *httpcodegen.EndpointData }
ServiceData contains the data necessary to generate origin handlers
Click to show internal directories.
Click to hide internal directories.