Recognize Next.js data redirects in authentication checks
waterfall-wiki CI and deployment / verify-and-deploy (push) Failing after 26m26s
waterfall-wiki CI and deployment / verify-and-deploy (push) Failing after 26m26s
This commit is contained in:
@@ -47,7 +47,7 @@ async function main() {
|
|||||||
if (command === 'verify' || command === 'exercise') {
|
if (command === 'verify' || command === 'exercise') {
|
||||||
const request = (path:string,init:RequestInit={}) => fetch(base+path,{...init,redirect:'manual'});
|
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']) {
|
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);
|
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);
|
assert.equal((await request('/api/posts',{method:'POST',body:'{}'})).status,401);
|
||||||
|
|||||||
Reference in New Issue
Block a user