summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/plugins/http/plugin_middleware.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/plugins/http/plugin_middleware.go b/tests/plugins/http/plugin_middleware.go
index 8d02524d..00640b69 100644
--- a/tests/plugins/http/plugin_middleware.go
+++ b/tests/plugins/http/plugin_middleware.go
@@ -6,15 +6,18 @@ import (
"github.com/spiral/roadrunner/v2/plugins/config"
)
+// PluginMiddleware test
type PluginMiddleware struct {
config config.Configurer
}
+// Init test
func (p *PluginMiddleware) Init(cfg config.Configurer) error {
p.config = cfg
return nil
}
+// Middleware test
func (p *PluginMiddleware) Middleware(next http.Handler) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path == "/halt" {
@@ -29,19 +32,23 @@ func (p *PluginMiddleware) Middleware(next http.Handler) http.HandlerFunc {
}
}
+// Name test
func (p *PluginMiddleware) Name() string {
return "pluginMiddleware"
}
+// PluginMiddleware2 test
type PluginMiddleware2 struct {
config config.Configurer
}
+// Init test
func (p *PluginMiddleware2) Init(cfg config.Configurer) error {
p.config = cfg
return nil
}
+// Middleware test
func (p *PluginMiddleware2) Middleware(next http.Handler) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path == "/boom" {
@@ -56,6 +63,7 @@ func (p *PluginMiddleware2) Middleware(next http.Handler) http.HandlerFunc {
}
}
+// Name test
func (p *PluginMiddleware2) Name() string {
return "pluginMiddleware2"
}