增加日志与退出时404问题处理

This commit is contained in:
andy committed 2026-08-18 16:58:58 +08:00
1 parent 2a2f78c81e
commit 648b274c55
7 files changed
+226 -2

No files matched your search

@@ -64,6 +64,20 @@ func TestAuthLogoutUsesRequestOriginAndExplicitCookieSecurity(t *testing.T) {
}
}
func TestAuthLogoutUsesPublicBaseURLBehindDevelopmentProxy(t *testing.T) {
handler := httpapi.NewAuthLogoutHandler(httpapi.LogoutConfig{PublicBaseURL: "http://127.0.0.1:3000"})
request := httptest.NewRequest(http.MethodPost, "http://127.0.0.1:8080/api/auth/logout", nil)
response := httptest.NewRecorder()
handler.ServeHTTP(response, request)
if response.Code != http.StatusTemporaryRedirect {
t.Fatalf("status = %d, want %d", response.Code, http.StatusTemporaryRedirect)
}
if got := response.Header().Get("Location"); got != "http://127.0.0.1:3000/auth/login?loggedOut=1" {
t.Fatalf("Location = %q", got)
}
}
func TestAuthLogoutMethodAndPathSemantics(t *testing.T) {
handler := httpapi.NewAuthLogoutHandler(httpapi.LogoutConfig{})
tests := []struct {