Skip to content

Commit 50d3813

Browse files
committed
Fix served file statistics
1 parent 5bf63ce commit 50d3813

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/server.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,8 @@ app.get('/*', asyncHandler(async (req, res, next) => {
399399
headers['Vary'] = 'Accept-Encoding';
400400
}
401401

402+
stats.handleServedFile(pathName);
403+
402404
res.sendFile(filePath, {
403405
headers,
404406
etag: false,

src/stats.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,10 @@ const handleRequest = (req) => {
131131
const handleServedFile = (path) => {
132132
requests.total++;
133133

134-
if (path.endsWith('.html')) {
135-
if (paths.has(path)) {
136-
paths.set(path, paths.get(path) + 1);
137-
} else {
138-
paths.set(path, 1);
139-
}
134+
if (paths.has(path)) {
135+
paths.set(path, paths.get(path) + 1);
136+
} else {
137+
paths.set(path, 1);
140138
}
141139
};
142140

0 commit comments

Comments
 (0)