c.Redirect() allows 201 status code

This commit is contained in:
Manu Mtz.-Almeida
2016-01-28 00:34:05 +01:00
parent b4963aa7de
commit 97cd894279
2 changed files with 24 additions and 3 deletions

View File

@ -16,7 +16,7 @@ type Redirect struct {
}
func (r Redirect) Render(w http.ResponseWriter) error {
if r.Code < 300 || r.Code > 308 {
if (r.Code < 300 || r.Code > 308) && r.Code != 201 {
panic(fmt.Sprintf("Cannot redirect with status code %d", r.Code))
}
http.Redirect(w, r.Request, r.Location, r.Code)