func Example_http() { hdlr := func(w http.ResponseWriter, req *http.Request) error { return ehttp.NewErrorf(http.StatusTeapot, "fail") } http.HandleFunc("/", ehttp.MWError(hdlr)) log.Fatal(http.ListenAndServe(":8080", nil)) }
func Example_gorilla() { hdlr := func(w http.ResponseWriter, req *http.Request) error { return ehttp.NewErrorf(http.StatusTeapot, "fail") } router := mux.NewRouter() router.HandleFunc("/", ehttp.MWError(hdlr)) log.Fatal(http.ListenAndServe(":8080", router)) }