From 447479c1fc0cb1c7ed99f2bbab63e2e05c00e959 Mon Sep 17 00:00:00 2001 From: Eltrac Date: Tue, 2 Dec 2025 16:07:11 +0800 Subject: feat(context.go): short cut to write Forbidden error response --- context.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/context.go b/context.go index 28f4c5a..271b886 100644 --- a/context.go +++ b/context.go @@ -66,6 +66,12 @@ func (c *Context) Unauthorized(msg string) { c.Error(http.StatusUnauthorized, msg) } +// Forbidden is a shortcut to write 403 Error to response writer +// this is based on Error function +func (c *Context) Forbidden(msg string) { + c.Error(http.StatusForbidden, msg) +} + // InternalError is a shortcut to write 500 Error to response writer // this is based on Error function func (c *Context) InternalError(msg string) { -- cgit v1.2.3