diff options
author | Valery Piashchynski <[email protected]> | 2021-05-13 19:42:32 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-05-13 19:42:32 +0300 |
commit | c7f900a7f02ea207392ee8126e141b2388ea44ca (patch) | |
tree | 4dfbfe4e2af158f69c27ec26dc47f211996f4afc | |
parent | 7ee84c5fd7cd57b97e2cb2005b37784183800ae0 (diff) |
- Use static plugin name as const
Signed-off-by: Valery Piashchynski <[email protected]>
-rw-r--r-- | plugins/http/serve.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/plugins/http/serve.go b/plugins/http/serve.go index 9bb11e35..78796322 100644 --- a/plugins/http/serve.go +++ b/plugins/http/serve.go @@ -231,10 +231,13 @@ func (s *Plugin) tlsAddr(host string, forcePort bool) string { return host } +// static plugin name +const static string = "static" + func applyMiddlewares(server *http.Server, middlewares map[string]Middleware, order []string, log logger.Logger) { for i := len(order) - 1; i >= 0; i-- { // set static last in the row - if order[i] == "static" { + if order[i] == static { continue } if mdwr, ok := middlewares[order[i]]; ok { @@ -245,7 +248,7 @@ func applyMiddlewares(server *http.Server, middlewares map[string]Middleware, or } // set static if exists - if mdwr, ok := middlewares["static"]; ok { + if mdwr, ok := middlewares[static]; ok { server.Handler = mdwr.Middleware(server.Handler) } } |