Skip to content

Commit 95f2b78

Browse files
test: update
1 parent daab78c commit 95f2b78

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

lib/Server.js

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -936,26 +936,28 @@ class Server {
936936
}
937937

938938
serveMagicHtml(req, res, next) {
939-
const _path = req.path;
939+
this.middleware.waitUntilValid(() => {
940+
const _path = req.path;
940941

941-
try {
942-
const filename = this.middleware.getFilenameFromUrl(`${_path}.js`);
943-
const isFile = this.middleware.context.outputFileSystem
944-
.statSync(filename)
945-
.isFile();
942+
try {
943+
const filename = this.middleware.getFilenameFromUrl(`${_path}.js`);
944+
const isFile = this.middleware.context.outputFileSystem
945+
.statSync(filename)
946+
.isFile();
946947

947-
if (!isFile) {
948-
return next();
949-
}
948+
if (!isFile) {
949+
return next();
950+
}
950951

951-
// Serve a page that executes the javascript
952-
const queries = req._parsedUrl.search || '';
953-
const responsePage = `<!DOCTYPE html><html><head><meta charset="utf-8"/></head><body><script type="text/javascript" charset="utf-8" src="${_path}.js${queries}"></script></body></html>`;
952+
// Serve a page that executes the javascript
953+
const queries = req._parsedUrl.search || '';
954+
const responsePage = `<!DOCTYPE html><html><head><meta charset="utf-8"/></head><body><script type="text/javascript" charset="utf-8" src="${_path}.js${queries}"></script></body></html>`;
954955

955-
res.send(responsePage);
956-
} catch (error) {
957-
return next();
958-
}
956+
res.send(responsePage);
957+
} catch (error) {
958+
return next();
959+
}
960+
});
959961
}
960962

961963
// Send stats to a socket or multiple sockets

0 commit comments

Comments
 (0)