diff options
author | Gabriel A. Giovanini <mail@gabrielgio.me> | 2025-03-30 17:34:11 +0200 |
---|---|---|
committer | Gabriel A. Giovanini <mail@gabrielgio.me> | 2025-03-30 17:34:11 +0200 |
commit | 2c0347566f99afec2e3963d74f4fc970e6187217 (patch) | |
tree | 0c63e87823ab595fffcd474143fa10269a4f65fd /pkg/ext/router.go | |
parent | f19adedc4b7f71c824a59d4a797bd8872bdb0bbd (diff) | |
download | cerrado-0.2.1.tar.gz cerrado-0.2.1.tar.bz2 cerrado-0.2.1.zip |
Diffstat (limited to 'pkg/ext/router.go')
-rw-r--r-- | pkg/ext/router.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/pkg/ext/router.go b/pkg/ext/router.go index ce4c126..434972b 100644 --- a/pkg/ext/router.go +++ b/pkg/ext/router.go @@ -69,6 +69,13 @@ func NotFound(w http.ResponseWriter, r *http.Request) { }, r.Context()) } +func BadRequest(w http.ResponseWriter, r *http.Request, msg string) { + w.WriteHeader(http.StatusBadRequest) + templates.WritePageTemplate(w, &templates.ErrorPage{ + Message: msg, + }, r.Context()) +} + func Redirect(w http.ResponseWriter, location string) { w.Header().Add("location", location) w.WriteHeader(http.StatusTemporaryRedirect) |