diff options
| author | Eltrac <hi@guhub.cn> | 2025-12-02 16:07:11 +0800 |
|---|---|---|
| committer | Eltrac <hi@guhub.cn> | 2025-12-02 16:07:11 +0800 |
| commit | 447479c1fc0cb1c7ed99f2bbab63e2e05c00e959 (patch) | |
| tree | eeb5027ab1f3f0d925dc2879f7ce0afb81220370 /context.go | |
| parent | 6ae235c31129190ed54e33b99f20deecc051ac04 (diff) | |
feat(context.go): short cut to write Forbidden error response
Diffstat (limited to 'context.go')
| -rw-r--r-- | context.go | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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) { |
