Skip to content

Commit ee54c7b

Browse files
committed
Merge pull request #63 from saranrapjs/cors-custom-origins
[feature] Export OriginValidator for documentation purposes.
2 parents 8171cd3 + 4f3e705 commit ee54c7b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cors.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ type cors struct {
1414
allowedHeaders []string
1515
allowedMethods []string
1616
allowedOrigins []string
17-
allowedOriginValidator originValidator
17+
allowedOriginValidator OriginValidator
1818
exposedHeaders []string
1919
maxAge int
2020
ignoreOptions bool
2121
allowCredentials bool
2222
}
2323

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

2727
var (
2828
defaultCorsMethods = []string{"GET", "HEAD", "POST"}
@@ -224,7 +224,7 @@ func AllowedOrigins(origins []string) CORSOption {
224224

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

0 commit comments

Comments
 (0)