aicra/middleware/types.go

27 lines
680 B
Go
Raw Normal View History

package middleware
import (
"net/http"
)
// Scope represents a list of scope processed by middlewares
// and used by the router to block/allow some uris
// it is also passed to controllers
type Scope []string
// Inspector updates the @Scope passed to it according to
// the @http.Request
2018-07-07 21:15:42 +00:00
type Inspector func(http.Request, *Scope)
// Middleware contains all necessary methods
// for a Middleware provided by user/developer
type MiddleWare struct {
2018-07-07 21:15:42 +00:00
Inspect func(http.Request, *Scope)
}
// MiddlewareRegistry represents a registry containing all registered
// middlewares to be processed before routing any request
type MiddlewareRegistry struct {
Middlewares []MiddleWare
}