19 lines
494 B
Go
19 lines
494 B
Go
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))
|
|
}
|