diff --git a/pages.go b/pages.go index 7481bc4..9d24bba 100644 --- a/pages.go +++ b/pages.go @@ -86,7 +86,10 @@ func oopsHandler(c web.C, w http.ResponseWriter, r *http.Request, rt RespType, m func badRequestHandler(c web.C, w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusBadRequest) - http.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest) + err := Templates["400.html"].ExecuteWriter(pongo2.Context{}, w) + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + } } func unauthorizedHandler(c web.C, w http.ResponseWriter, r *http.Request) { diff --git a/templates.go b/templates.go index 6575881..d8cd7bf 100644 --- a/templates.go +++ b/templates.go @@ -45,8 +45,9 @@ func populateTemplatesMap(tSet *pongo2.TemplateSet, tMap map[string]*pongo2.Temp "index.html", "paste.html", "API.html", - "404.html", + "400.html", "401.html", + "404.html", "oops.html", "display/audio.html", diff --git a/templates/400.html b/templates/400.html new file mode 100644 index 0000000..11f3e87 --- /dev/null +++ b/templates/400.html @@ -0,0 +1,5 @@ +{% extends "base.html" %} + +{% block content %} +400 Bad Request +{% endblock %}