Skip to content

Commit 4850d69

Browse files
committed
Fixed basic-auth middleware
Signed-off-by: Vishal Rana <vr@labstack.com>
1 parent 025c53d commit 4850d69

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

middleware/basic_auth.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ type (
1313
Skipper Skipper
1414

1515
// Validator is a function to validate BasicAuth credentials.
16+
// Required.
1617
Validator BasicAuthValidator
1718
}
1819

@@ -46,6 +47,9 @@ func BasicAuth(fn BasicAuthValidator) echo.MiddlewareFunc {
4647
// See `BasicAuth()`.
4748
func BasicAuthWithConfig(config BasicAuthConfig) echo.MiddlewareFunc {
4849
// Defaults
50+
if config.Validator == nil {
51+
panic("basic-auth middleware requires validator function")
52+
}
4953
if config.Skipper == nil {
5054
config.Skipper = DefaultBasicAuthConfig.Skipper
5155
}

middleware/redirect.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ func WWWRedirectWithConfig(config RedirectConfig) echo.MiddlewareFunc {
135135
}
136136
}
137137

138-
// NonWWWRedirect redirects WWW request to non WWW.
138+
// NonWWWRedirect redirects WWW requests to non WWW.
139139
// For example, http://www.labstack.com will be redirect to http://labstack.com.
140140
//
141141
// Usage `Echo#Pre(NonWWWRedirect())`

0 commit comments

Comments
 (0)