INNER CODE UNIT · Go
handler
cloudflare/alertmanager2es · main.go:115
func handler(w http.ResponseWriter, r *http.Request) {
notificationsReceived.Inc()
if r.Body == nil {
notificationsInvalid.Inc()
err := errors.New("got empty request body")
http.Error(w, err.Error(), http.StatusBadRequest)
log.Print(err)
return
}
b, err := ioutil.ReadAll(r.Body)
if err != nil {
notificationsErrored.Inc()
http.Error(w, err.Error(), http.StatusInternalServerError)
log.Print(err)
return
}