Skip to content

Commit 96554c4

Browse files
committed
fix: fix slash redirect test
1 parent 0bf4c00 commit 96554c4

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

elton_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,8 @@ func TestTrailingSlashRedirect(t *testing.T) {
496496
req := httptest.NewRequest(http.MethodGet, "http://example.com/dir", nil)
497497
resp := httptest.NewRecorder()
498498
e.ServeHTTP(resp, req)
499-
assert.Equal(http.StatusTemporaryRedirect, resp.Code)
499+
// ServeMux 的重定向状态码随 Go 版本变化:<=1.25 为 301,1.26+ 为 307
500+
assert.Contains([]int{http.StatusMovedPermanently, http.StatusTemporaryRedirect}, resp.Code)
500501
assert.Equal("/dir/", resp.Header().Get("Location"))
501502
}
502503

0 commit comments

Comments
 (0)