weldr: Return a JSON API error response for all unknown requests

This matches the lorax-composer behavior.
This commit is contained in:
Brian C. Lane 2020-03-26 16:52:13 -07:00 committed by Tom Gundersen
parent e3934108f7
commit fc205786fc
3 changed files with 10 additions and 5 deletions

View file

@ -167,7 +167,12 @@ func methodNotAllowedHandler(writer http.ResponseWriter, request *http.Request)
}
func notFoundHandler(writer http.ResponseWriter, request *http.Request) {
writer.WriteHeader(http.StatusNotFound)
errors := responseError{
Code: http.StatusNotFound,
ID: "HTTPError",
Msg: "Not Found",
}
statusResponseError(writer, http.StatusNotFound, errors)
}
func notImplementedHandler(writer http.ResponseWriter, httpRequest *http.Request, _ httprouter.Params) {