Use http.StatusFound so the forms don't get redirected

This commit is contained in:
Las Zenow 2012-10-29 21:52:02 +01:00
parent 857dc5f57c
commit ba13a69f4a
2 changed files with 9 additions and 7 deletions

View file

@ -72,9 +72,9 @@ func deleteHandler(w http.ResponseWriter, r *http.Request) {
}
sess.Save(w, r)
if isNew {
http.Redirect(w, r, "/new/", http.StatusTemporaryRedirect)
http.Redirect(w, r, "/new/", http.StatusFound)
} else {
http.Redirect(w, r, "/", http.StatusTemporaryRedirect)
http.Redirect(w, r, "/", http.StatusFound)
}
}
@ -144,9 +144,9 @@ func saveHandler(w http.ResponseWriter, r *http.Request) {
sess.Notify("Book Modified!", "", "success")
sess.Save(w, r)
if db.BookActive(id) {
http.Redirect(w, r, "/book/"+idStr, http.StatusTemporaryRedirect)
http.Redirect(w, r, "/book/"+idStr, http.StatusFound)
} else {
http.Redirect(w, r, "/new/", http.StatusTemporaryRedirect)
http.Redirect(w, r, "/new/", http.StatusFound)
}
}
@ -220,5 +220,5 @@ func storeHandler(w http.ResponseWriter, r *http.Request) {
sess.Notify("Store books!", "The books '"+strings.Join(titles, ", ")+"' are stored for public download", "success")
}
sess.Save(w, r)
http.Redirect(w, r, "/new/", http.StatusTemporaryRedirect)
http.Redirect(w, r, "/new/", http.StatusFound)
}