Fix feedback auth for expired users

This commit is contained in:
2569718930@qq.com
2026-06-14 04:57:42 +08:00
parent e74dfb4953
commit 6142a9cb65
7 changed files with 84 additions and 2 deletions
+3
View File
@@ -50,6 +50,9 @@ export async function GET(req: NextRequest) {
cache: "no-store",
});
const raw = await res.text();
if (res.status === 401 || res.status === 403) {
return applyAuthResponseCookies(emptyFeedbackResponse(), auth.response);
}
if (!res.ok) {
return applyAuthResponseCookies(
buildUpstreamErrorResponse(res.status, raw, {
@@ -72,6 +72,7 @@ export function runTests() {
assert(
feedbackRouteSource.includes("emptyFeedbackResponse") &&
feedbackRouteSource.includes("if (!auth.authUserId)") &&
feedbackRouteSource.includes("if (res.status === 401 || res.status === 403)") &&
!feedbackRouteSource.includes("const authError = requireBackendPaymentAuth(auth);"),
"feedback GET proxy must return an empty optional list instead of surfacing a 401 when no Supabase user identity is verified",
);