ozzo-routing
ozzo-routing copied to clipboard
`http: multiple response.WriteHeader calls` when using fault.Recovery
test code is:
package main
import (
"github.com/go-ozzo/ozzo-routing"
"github.com/go-ozzo/ozzo-routing/fault"
"log"
"net/http"
)
func main() {
router := routing.New()
router.Use(
fault.Recovery(log.Printf, func(c *routing.Context, err error) error {
c.Write(err)
return nil
}),
)
http.Handle("/", router)
http.ListenAndServe(":8123", nil)
}
on error occurred, it will log an additional message: http: multiple response.WriteHeader calls
2018/01/24 12:08:54 Not Found
2018/01/24 12:08:54 http: multiple response.WriteHeader calls