From 1818d94c5fe6dc89033952689bdf900a28c056c4 Mon Sep 17 00:00:00 2001 From: arshabbir Date: Thu, 5 May 2022 16:50:10 +0530 Subject: [PATCH] save the return line #3116 --- context.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/context.go b/context.go index 5e53aaf0..059c3bd0 100644 --- a/context.go +++ b/context.go @@ -824,8 +824,12 @@ func bodyAllowedForStatus(status int) bool { } // Status sets the HTTP response code. -func (c *Context) Status(code int) { - c.Writer.WriteHeader(code) +func (c *Context) Status(code int) error { + if code > 0 { + c.Writer.WriteHeader(code) + return nil + } + return errors.New("invalid status code") } // Header is an intelligent shortcut for c.Writer.Header().Set(key, value).