summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-12-02 16:07:11 +0800
committerEltrac <hi@guhub.cn>2025-12-02 16:07:11 +0800
commit447479c1fc0cb1c7ed99f2bbab63e2e05c00e959 (patch)
treeeeb5027ab1f3f0d925dc2879f7ce0afb81220370
parent6ae235c31129190ed54e33b99f20deecc051ac04 (diff)
feat(context.go): short cut to write Forbidden error response
-rw-r--r--context.go6
1 files changed, 6 insertions, 0 deletions
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) {