test: 新增网页元素演练场页面与三项网页自动化测试任务
This commit is contained in:
1 parent
a5d9f0bfee
commit
67a418129b
2 files changed
+51
No files matched your search
@@ -28,6 +28,13 @@ export async function startFixtureServer(preferredPort = 17863): Promise<string>
|
||||
return;
|
||||
}
|
||||
if (url.pathname !== "/" && url.pathname !== "/index.html") {
|
||||
const safe = path.basename(url.pathname);
|
||||
const file = path.join(root, safe);
|
||||
if (/\.(html|css|js|png|jpg|svg)$/i.test(safe) && fs.existsSync(file)) {
|
||||
response.writeHead(200, { "Content-Type": safe.endsWith(".html") ? "text/html; charset=utf-8" : "application/octet-stream", "Cache-Control": "no-store" });
|
||||
fs.createReadStream(file).pipe(response);
|
||||
return;
|
||||
}
|
||||
response.writeHead(404).end("Not found");
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user