alertmanager/examples/webhook/echo.go

20 lines
354 B
Go
Raw Normal View History

2016-08-19 10:13:02 +00:00
package main
import (
"io/ioutil"
"log"
"net/http"
)
func main() {
http.ListenAndServe(":5001", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
log.Println("received request:", r.Header)
b, err := ioutil.ReadAll(r.Body)
if err != nil {
panic(err)
}
defer r.Body.Close()
log.Println("request body:", string(b))
}))
}