mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 05:34:05 -08:00
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.Post("/-/reload", h.reload)
|
||||||
router.Put("/-/reload", h.reload)
|
router.Put("/-/reload", h.reload)
|
||||||
} else {
|
} else {
|
||||||
router.Post("/-/quit", func(w http.ResponseWriter, _ *http.Request) {
|
forbiddenAPINotEnabled := func(w http.ResponseWriter, _ *http.Request) {
|
||||||
w.WriteHeader(http.StatusForbidden)
|
w.WriteHeader(http.StatusForbidden)
|
||||||
w.Write([]byte("Lifecycle APIs are not enabled"))
|
w.Write([]byte("Lifecycle API is not enabled."))
|
||||||
})
|
}
|
||||||
router.Post("/-/reload", func(w http.ResponseWriter, _ *http.Request) {
|
router.Post("/-/quit", forbiddenAPINotEnabled)
|
||||||
w.WriteHeader(http.StatusForbidden)
|
router.Put("/-/quit", forbiddenAPINotEnabled)
|
||||||
w.Write([]byte("Lifecycle APIs are not enabled"))
|
router.Post("/-/reload", forbiddenAPINotEnabled)
|
||||||
})
|
router.Put("/-/reload", forbiddenAPINotEnabled)
|
||||||
}
|
}
|
||||||
router.Get("/-/quit", func(w http.ResponseWriter, _ *http.Request) {
|
router.Get("/-/quit", func(w http.ResponseWriter, _ *http.Request) {
|
||||||
w.WriteHeader(http.StatusMethodNotAllowed)
|
w.WriteHeader(http.StatusMethodNotAllowed)
|
||||||
|
|
Loading…
Reference in a new issue