Use http.StatusTemporaryRedirect instead of hardcoded 307

This commit is contained in:
Las Zenow 2012-10-29 21:43:55 +01:00
parent 038cac6a62
commit 857dc5f57c
3 changed files with 8 additions and 8 deletions

View file

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

View file

@ -143,7 +143,7 @@ func readHandler(w http.ResponseWriter, r *http.Request) {
if file == "" { if file == "" {
it := e.Iterator(epub.EITERATOR_LINEAR) it := e.Iterator(epub.EITERATOR_LINEAR)
defer it.Close() defer it.Close()
http.Redirect(w, r, base+id+"/"+it.CurrUrl(), 307) http.Redirect(w, r, base+id+"/"+it.CurrUrl(), http.StatusTemporaryRedirect)
return return
} }

View file

@ -22,7 +22,7 @@ func logoutHandler(w http.ResponseWriter, r *http.Request) {
sess.LogOut() sess.LogOut()
sess.Notify("Log out!", "Bye bye "+sess.User, "success") sess.Notify("Log out!", "Bye bye "+sess.User, "success")
sess.Save(w, r) sess.Save(w, r)
http.Redirect(w, r, "/", 307) http.Redirect(w, r, "/", http.StatusTemporaryRedirect)
} }
func loginHandler(w http.ResponseWriter, r *http.Request) { func loginHandler(w http.ResponseWriter, r *http.Request) {
@ -38,7 +38,7 @@ func loginHandler(w http.ResponseWriter, r *http.Request) {
} }
sess.Save(w, r) sess.Save(w, r)
} }
http.Redirect(w, r, r.Referer(), 307) http.Redirect(w, r, r.Referer(), http.StatusTemporaryRedirect)
} }
type bookData struct { type bookData struct {