summaryrefslogtreecommitdiff
path: root/plugins/headers/plugin.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/headers/plugin.go')
-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()