Skip to content

Commit

Permalink
exporting the OriginValidator type, for documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
saranrapjs committed Jan 16, 2016
1 parent 6597b14 commit 4f3e705
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cors.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ type cors struct {
allowedHeaders []string
allowedMethods []string
allowedOrigins []string
allowedOriginValidator originValidator
allowedOriginValidator OriginValidator
exposedHeaders []string
maxAge int
ignoreOptions bool
allowCredentials bool
}

// originValidator takes an origin string and returns whether or not that origin is allowed.
type originValidator func(string) bool
// OriginValidator takes an origin string and returns whether or not that origin is allowed.
type OriginValidator func(string) bool

var (
defaultCorsMethods = []string{"GET", "HEAD", "POST"}
Expand Down Expand Up @@ -223,7 +223,7 @@ func AllowedOrigins(origins []string) CORSOption {

// AllowedOriginValidator sets a function for evaluating allowed origins in CORS requests, represented by the
// 'Allow-Access-Control-Origin' HTTP header.
func AllowedOriginValidator(fn originValidator) CORSOption {
func AllowedOriginValidator(fn OriginValidator) CORSOption {
return func(ch *cors) error {
ch.allowedOriginValidator = fn
return nil
Expand Down

0 comments on commit 4f3e705

Please sign in to comment.