Recognize Next.js data redirects in authentication checks
waterfall-wiki CI and deployment / verify-and-deploy (push) Failing after 26m26s

This commit is contained in:
2026-10-27 00:41:31 +08:00
parent ad398db781
commit 6c11c8ac26
+1 -1
View File
@@ -47,7 +47,7 @@ async function main() {
if (command === 'verify' || command === 'exercise') {
const request = (path:string,init:RequestInit={}) => fetch(base+path,{...init,redirect:'manual'});
for (const path of ['/','/library/import','/skills/shadow-puppet/egret-example.png','/studio','/_next/data/auth-test/index.json']) {
const response = await request(path); assert.equal(response.status,307,path); assert.match(response.headers.get('location') || '',/\/login\?/);
const response = await request(path); assert.equal(response.status,307,path); assert.match(response.headers.get('location') || response.headers.get('x-nextjs-redirect') || '',/\/login\?/,path+' must redirect to login');
}
for (const path of ['/api/feed','/api/upload','/studio/api/export/test','/api/media/missing']) assert.equal((await request(path)).status,401,path);
assert.equal((await request('/api/posts',{method:'POST',body:'{}'})).status,401);