summaryrefslogtreecommitdiff
path: root/plugins/headers
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-04-30 11:44:07 +0300
committerValery Piashchynski <[email protected]>2021-04-30 11:44:07 +0300
commit50aa751dcefc0ab0e96594a5f111ead316a34a70 (patch)
tree5cf1fd278e01e1bd23a3f39d408ceb49741c448c /plugins/headers
parent65015a3d3f4b387675b5ca005b8831a6be9e15aa (diff)
- Update Lister implementation
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'plugins/headers')
-rw-r--r--plugins/headers/plugin.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/plugins/headers/plugin.go b/plugins/headers/plugin.go
index dea0d127..caba6aeb 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,11 @@ func (s *Plugin) Name() string {
return PluginName
}
+// Available interface implementation
+func (s *Plugin) Available() bool {
+ return true
+}
+
// configure OPTIONS response
func (s *Plugin) preflightRequest(w http.ResponseWriter) {
headers := w.Header()