mirror of
https://github.com/ZizzyDizzyMC/linx-server.git
synced 2026-01-23 02:14:33 +00:00
use 303 redirects instead of 301s
HTTP status code 301 is for a permanent redirect, which these are not. Although 302 would work here in most browsers, it would not follow the HTTP spec, so instead we use 303 which has a clearly and consistently defined behavior in response to a POST or PUT request.
This commit is contained in:
parent
354278d488
commit
52ec9f8e2d
2 changed files with 9 additions and 9 deletions
|
|
@ -126,8 +126,8 @@ func TestPostCodeUpload(t *testing.T) {
|
|||
|
||||
mux.ServeHTTP(w, req)
|
||||
|
||||
if w.Code != 301 {
|
||||
t.Fatalf("Status code is not 301, but %d", w.Code)
|
||||
if w.Code != 303 {
|
||||
t.Fatalf("Status code is not 303, but %d", w.Code)
|
||||
}
|
||||
|
||||
if w.Header().Get("Location") != "/"+filename+"."+extension {
|
||||
|
|
@ -157,8 +157,8 @@ func TestPostCodeUploadWhitelistedHeader(t *testing.T) {
|
|||
|
||||
mux.ServeHTTP(w, req)
|
||||
|
||||
if w.Code != 301 {
|
||||
t.Fatalf("Status code is not 301, but %d", w.Code)
|
||||
if w.Code != 303 {
|
||||
t.Fatalf("Status code is not 303, but %d", w.Code)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -287,8 +287,8 @@ func TestPostUpload(t *testing.T) {
|
|||
|
||||
mux.ServeHTTP(w, req)
|
||||
|
||||
if w.Code != 301 {
|
||||
t.Fatalf("Status code is not 301, but %d", w.Code)
|
||||
if w.Code != 303 {
|
||||
t.Fatalf("Status code is not 303, but %d", w.Code)
|
||||
}
|
||||
|
||||
if w.Header().Get("Location") != "/"+filename {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue