Merge pull request #55 from mutantmonkey/redirect_fix

use 303 redirects instead of 301s
This commit is contained in:
Andrei Marcu 2015-10-10 23:25:57 -04:00
commit 6c9d517c80
2 changed files with 9 additions and 9 deletions

View File

@ -126,8 +126,8 @@ func TestPostCodeUpload(t *testing.T) {
mux.ServeHTTP(w, req) mux.ServeHTTP(w, req)
if w.Code != 301 { if w.Code != 303 {
t.Fatalf("Status code is not 301, but %d", w.Code) t.Fatalf("Status code is not 303, but %d", w.Code)
} }
if w.Header().Get("Location") != "/"+filename+"."+extension { if w.Header().Get("Location") != "/"+filename+"."+extension {
@ -157,8 +157,8 @@ func TestPostCodeUploadWhitelistedHeader(t *testing.T) {
mux.ServeHTTP(w, req) mux.ServeHTTP(w, req)
if w.Code != 301 { if w.Code != 303 {
t.Fatalf("Status code is not 301, but %d", w.Code) t.Fatalf("Status code is not 303, but %d", w.Code)
} }
} }
@ -287,8 +287,8 @@ func TestPostUpload(t *testing.T) {
mux.ServeHTTP(w, req) mux.ServeHTTP(w, req)
if w.Code != 301 { if w.Code != 303 {
t.Fatalf("Status code is not 301, but %d", w.Code) t.Fatalf("Status code is not 303, but %d", w.Code)
} }
if w.Header().Get("Location") != "/"+filename { if w.Header().Get("Location") != "/"+filename {

View File

@ -103,7 +103,7 @@ func uploadPostHandler(c web.C, w http.ResponseWriter, r *http.Request) {
return return
} }
http.Redirect(w, r, "/"+upload.Filename, 301) http.Redirect(w, r, "/"+upload.Filename, 303)
} }
} }
@ -139,7 +139,7 @@ func uploadPutHandler(c web.C, w http.ResponseWriter, r *http.Request) {
func uploadRemote(c web.C, w http.ResponseWriter, r *http.Request) { func uploadRemote(c web.C, w http.ResponseWriter, r *http.Request) {
if r.FormValue("url") == "" { if r.FormValue("url") == "" {
http.Redirect(w, r, "/", 301) http.Redirect(w, r, "/", 303)
return return
} }
@ -174,7 +174,7 @@ func uploadRemote(c web.C, w http.ResponseWriter, r *http.Request) {
return return
} }
http.Redirect(w, r, "/"+upload.Filename, 301) http.Redirect(w, r, "/"+upload.Filename, 303)
} }
} }