mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-16 21:32:11 +08:00
add RenderWith
RenderWith will is not panic while render is fail.
This commit is contained in:
parent
e2212d40c6
commit
81b497afed
@ -422,6 +422,11 @@ func (c *Context) Cookie(name string) (string, error) {
|
||||
return val, nil
|
||||
}
|
||||
|
||||
func (c *Context) RenderWith(code int, r render.Render) error {
|
||||
c.Status(code)
|
||||
return r.Render(c.Writer)
|
||||
}
|
||||
|
||||
func (c *Context) Render(code int, r render.Render) {
|
||||
c.Status(code)
|
||||
if err := r.Render(c.Writer); err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user