package handler import ( "errors" "net/http" ) type NotFoundHandler struct{} func (NotFoundHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { encodeResponse(w, &response{http.StatusNotFound, ""}, errors.New("Path "+r.RequestURI+" not found")) } type MethodNotAllowedHandler struct{} func (MethodNotAllowedHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { encodeResponse(w, &response{http.StatusMethodNotAllowed, ""}, errors.New("Method Not Allowed: "+r.Method)) }