diff options
Diffstat (limited to 'kcore/http.go')
| -rw-r--r-- | kcore/http.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/kcore/http.go b/kcore/http.go index e5d218b..f1a2b1a 100644 --- a/kcore/http.go +++ b/kcore/http.go @@ -26,3 +26,11 @@ func RenderPage(ctx context.Context, page templ.Component, w http.ResponseWriter _, err = buf.WriteTo(w) Expect(err, "error writing page to response writer") } + +func Unauthorized(w http.ResponseWriter, err error) { + w.WriteHeader(http.StatusUnauthorized) + if err != nil { + _, err = w.Write([]byte(err.Error())) + Expect(err, "error writing response") + } +} |
