Return 403 with PUT verb if lifecycle is not enabled
Signed-off-by: Sven Nebel <nebel.sven@gmail.com>
This commit is contained in:
parent
c6928b5c6e
commit
d186d85649
12
web/web.go
12
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"))
|
||||
})
|
||||
}
|
||||
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