minfix
This commit is contained in:
parent
1afe04e13f
commit
da38582add
|
@ -81,7 +81,7 @@ func (tr *MiddlewareRegistry) Add(pluginName string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (6) Cast Inspect */
|
/* (6) Cast Inspect */
|
||||||
inspectCast, ok := inspect.(func(http.Request, Scope))
|
inspectCast, ok := inspect.(func(http.Request, *Scope))
|
||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("Inspect() is malformed")
|
return fmt.Errorf("Inspect() is malformed")
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ func (mr MiddlewareRegistry) Run(req http.Request) Scope {
|
||||||
|
|
||||||
/* (2) Execute each middleware */
|
/* (2) Execute each middleware */
|
||||||
for _, m := range mr.Middlewares {
|
for _, m := range mr.Middlewares {
|
||||||
m.Inspect(req, scope)
|
m.Inspect(req, &scope)
|
||||||
}
|
}
|
||||||
|
|
||||||
return scope
|
return scope
|
||||||
|
|
|
@ -11,12 +11,12 @@ type Scope []string
|
||||||
|
|
||||||
// Inspector updates the @Scope passed to it according to
|
// Inspector updates the @Scope passed to it according to
|
||||||
// the @http.Request
|
// the @http.Request
|
||||||
type Inspector func(http.Request, Scope)
|
type Inspector func(http.Request, *Scope)
|
||||||
|
|
||||||
// Middleware contains all necessary methods
|
// Middleware contains all necessary methods
|
||||||
// for a Middleware provided by user/developer
|
// for a Middleware provided by user/developer
|
||||||
type MiddleWare struct {
|
type MiddleWare struct {
|
||||||
Inspect func(http.Request, Scope)
|
Inspect func(http.Request, *Scope)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MiddlewareRegistry represents a registry containing all registered
|
// MiddlewareRegistry represents a registry containing all registered
|
||||||
|
|
Loading…
Reference in New Issue