summaryrefslogtreecommitdiff
path: root/plugins/headers/plugin.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-04-30 16:30:54 +0300
committerGitHub <[email protected]>2021-04-30 16:30:54 +0300
commit009b7009885d8a15e6fa6c7e78436087b2f20129 (patch)
tree6bab1f99aa83c794060ab4c913d5ff62fef6882d /plugins/headers/plugin.go
parent684864530618f4b82399e5f1a89d5967c6ca9bcb (diff)
parent556477ca9df3fa2e5939057861314eabe5ce30ca (diff)
#652 feat(informer): list of active plugins in runtime
#652 feat(informer): list of active plugins in runtime
Diffstat (limited to 'plugins/headers/plugin.go')
-rw-r--r--plugins/headers/plugin.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/plugins/headers/plugin.go b/plugins/headers/plugin.go
index dea0d127..19c444df 100644
--- a/plugins/headers/plugin.go
+++ b/plugins/headers/plugin.go
@@ -8,11 +8,11 @@ import (
"github.com/spiral/roadrunner/v2/plugins/config"
)
-// ID contains default service name.
+// PluginName contains default service name.
const PluginName = "headers"
const RootPluginName = "http"
-// Service serves headers files. Potentially convert into middleware?
+// Plugin serves headers files. Potentially convert into middleware?
type Plugin struct {
// server configuration (location, forbidden files and etc)
cfg *Config
@@ -37,7 +37,7 @@ func (s *Plugin) Init(cfg config.Configurer) error {
return nil
}
-// middleware must return true if request/response pair is handled within the middleware.
+// Middleware is HTTP plugin middleware to serve headers
func (s *Plugin) Middleware(next http.Handler) http.Handler {
// Define the http.HandlerFunc
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
@@ -69,6 +69,9 @@ func (s *Plugin) Name() string {
return PluginName
}
+// Available interface implementation
+func (s *Plugin) Available() {}
+
// configure OPTIONS response
func (s *Plugin) preflightRequest(w http.ResponseWriter) {
headers := w.Header()