Skip to content

Commit

Permalink
Merge pull request #63 from saranrapjs/cors-custom-origins
Browse files Browse the repository at this point in the history
[feature] Export OriginValidator for documentation purposes.
  • Loading branch information
elithrar committed Feb 28, 2016
2 parents 8171cd3 + 4f3e705 commit ee54c7b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cors.go
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 @@ -224,7 +224,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 ee54c7b

Please sign in to comment.