Fix feedback auth for expired users
This commit is contained in:
@@ -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",
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user