goa: github.com/goadesign/goa/cors Index | Files

package cors

import "github.com/goadesign/goa/cors"

Package cors provides the means for implementing the server side of CORS, see https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS.

Index

Package Files

cors.go

Constants

const OriginKey key = "origin"

OriginKey is the context key used to store the request origin match

func HandlePreflight Uses

func HandlePreflight() goa.Handler

HandlePreflight returns a simple 200 response. The middleware takes care of handling CORS.

func MatchOrigin Uses

func MatchOrigin(origin, spec string) bool

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

func MatchOriginRegexp Uses

func MatchOriginRegexp(origin string, spec *regexp.Regexp) bool

MatchOriginRegexp returns true if the given Origin header value matches the origin specification. Spec must be a valid regex

Package cors imports 5 packages (graph) and is imported by 7 packages. Updated 2017-04-13. Refresh now. Tools for package owners.