From 79131ac84d5c7d9d5b6ccad779db1789fc76a938 Mon Sep 17 00:00:00 2001 From: Manu Mtz-Almeida Date: Thu, 7 May 2015 11:28:25 +0200 Subject: [PATCH] Tail call optimization --- context.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/context.go b/context.go index 6fe9484c..65eef13c 100644 --- a/context.go +++ b/context.go @@ -356,11 +356,10 @@ func (c *Context) HTMLString(code int, format string, values ...interface{}) { // Returns a HTTP redirect to the specific location. func (c *Context) Redirect(code int, location string) { - if code >= 300 && code <= 308 { - c.Render(code, render.Redirect, c.Request, location) - } else { + if code < 300 || code > 308 { panic(fmt.Sprintf("Cannot redirect with status code %d", code)) } + c.Render(code, render.Redirect, c.Request, location) } // Writes some data into the body stream and updates the HTTP code.