1 parent 0bf4c00 commit 96554c4Copy full SHA for 96554c4
1 file changed
elton_test.go
@@ -496,7 +496,8 @@ func TestTrailingSlashRedirect(t *testing.T) {
496
req := httptest.NewRequest(http.MethodGet, "http://example.com/dir", nil)
497
resp := httptest.NewRecorder()
498
e.ServeHTTP(resp, req)
499
- assert.Equal(http.StatusTemporaryRedirect, resp.Code)
+ // ServeMux 的重定向状态码随 Go 版本变化:<=1.25 为 301,1.26+ 为 307
500
+ assert.Contains([]int{http.StatusMovedPermanently, http.StatusTemporaryRedirect}, resp.Code)
501
assert.Equal("/dir/", resp.Header().Get("Location"))
502
}
503
0 commit comments