Skip to content

Commit 4f3e705

Browse files
committed
exporting the OriginValidator type, for documentation
1 parent 6597b14 commit 4f3e705

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cors.go

Lines changed: 4 additions & 4 deletions
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"}
@@ -223,7 +223,7 @@ func AllowedOrigins(origins []string) CORSOption {
223223

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

0 commit comments

Comments
 (0)