More Middleware -> Plugin conversions (#1088)

Forgot about these.
This commit is contained in:
Miek Gieben
2017-09-16 14:13:28 +01:00
committed by GitHub
parent 6f874f0bd1
commit be47709270
15 changed files with 23 additions and 23 deletions

View File

@@ -25,7 +25,7 @@ autopath.Func. Note the searchpath must be ending with the empty string.
I.e:
func (m Middleware ) AutoPath(state request.Request) []string {
func (m Plugins ) AutoPath(state request.Request) []string {
return []string{"first", "second", "last", ""}
}
*/

View File

@@ -49,8 +49,8 @@ func setup(c *caddy.Controller) error {
return nil
}
// allowedMiddleware has a list of plugin that can be used by autopath.
var allowedMiddleware = map[string]bool{
// allowedPlugins has a list of plugin that can be used by autopath.
var allowedPlugins = map[string]bool{
"@kubernetes": true,
"@erratic": true,
}
@@ -66,7 +66,7 @@ func autoPathParse(c *caddy.Controller) (*AutoPath, string, error) {
}
resolv := zoneAndresolv[len(zoneAndresolv)-1]
if resolv[0] == '@' {
_, ok := allowedMiddleware[resolv]
_, ok := allowedPlugins[resolv]
if ok {
mw = resolv[1:]
}

View File

@@ -55,7 +55,7 @@ func TestSetupAutoPath(t *testing.T) {
}
if !test.shouldErr && mw != test.expectedMw {
t.Errorf("Test %d, Middleware not correctly set for input %s. Expected: %s, actual: %s", i, test.input, test.expectedMw, mw)
t.Errorf("Test %d, Plugin not correctly set for input %s. Expected: %s, actual: %s", i, test.input, test.expectedMw, mw)
}
if !test.shouldErr && ap.search != nil {
if !reflect.DeepEqual(test.expectedSearch, ap.search) {