Tail call optimization

This commit is contained in:
Manu Mtz-Almeida 2015-05-07 11:28:25 +02:00
parent f1a2b94b36
commit 79131ac84d
1 changed files with 2 additions and 3 deletions

View File

@ -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.