test(sheet): cover float image redirect rejection

This commit is contained in:
xiatian
2026-08-24 14:48:12 +08:00
parent 583d31141d
commit fdb5fc19f5
@@ -377,7 +377,7 @@ func TestCrossPlatformCoverageFloatImageHTTPPut(t *testing.T) {
defer destination.Close()
source := httptest.NewServer(http.HandlerFunc(func(response http.ResponseWriter, _ *http.Request) {
response.Header().Set("Location", destination.URL+"/location-secret")
response.WriteHeader(http.StatusTemporaryRedirect)
response.WriteHeader(http.StatusFound)
}))
defer source.Close()
client := newFloatImageUploadClient()
@@ -385,7 +385,7 @@ func TestCrossPlatformCoverageFloatImageHTTPPut(t *testing.T) {
t.Fatalf("timeout = %v", client.Timeout)
}
err := putFloatImageFileWithClient(context.Background(), client, source.URL, local)
if err == nil || !strings.Contains(err.Error(), "HTTP 307") || strings.Contains(err.Error(), "location-secret") || destinationCalls != 0 {
if err == nil || !strings.Contains(err.Error(), "HTTP 302") || strings.Contains(err.Error(), "location-secret") || destinationCalls != 0 {
t.Fatalf("redirect error/calls = %v/%d", err, destinationCalls)
}
})