Merge pull request #6057 from snebel29/fix/management-api-return-code-when-disabled
Fix management api return code when lifecycle API is disabled
This commit is contained in:
commit
ea2c836e1b
14
web/web.go
14
web/web.go
|
@ -344,14 +344,14 @@ func New(logger log.Logger, o *Options) *Handler {
|
|||
router.Post("/-/reload", h.reload)
|
||||
router.Put("/-/reload", h.reload)
|
||||
} else {
|
||||
router.Post("/-/quit", func(w http.ResponseWriter, _ *http.Request) {
|
||||
forbiddenAPINotEnabled := func(w http.ResponseWriter, _ *http.Request) {
|
||||
w.WriteHeader(http.StatusForbidden)
|
||||
w.Write([]byte("Lifecycle APIs are not enabled"))
|
||||
})
|
||||
router.Post("/-/reload", func(w http.ResponseWriter, _ *http.Request) {
|
||||
w.WriteHeader(http.StatusForbidden)
|
||||
w.Write([]byte("Lifecycle APIs are not enabled"))
|
||||
})
|
||||
w.Write([]byte("Lifecycle API is not enabled."))
|
||||
}
|
||||
router.Post("/-/quit", forbiddenAPINotEnabled)
|
||||
router.Put("/-/quit", forbiddenAPINotEnabled)
|
||||
router.Post("/-/reload", forbiddenAPINotEnabled)
|
||||
router.Put("/-/reload", forbiddenAPINotEnabled)
|
||||
}
|
||||
router.Get("/-/quit", func(w http.ResponseWriter, _ *http.Request) {
|
||||
w.WriteHeader(http.StatusMethodNotAllowed)
|
||||
|
|
Loading…
Reference in New Issue