Skip to content

Commit f8bb8b9

Browse files
committed
Add short circuit if using cache
1 parent 304f922 commit f8bb8b9

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/express-http-server.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ class ExpressHTTPServer {
3838
app.use(require('compression')());
3939
}
4040

41+
if (this.cache && this.gzip) {
42+
app.use(function(req, res, next) {
43+
if (res.body) {
44+
res.send(res.body);
45+
} else {
46+
next();
47+
}
48+
});
49+
}
50+
4151
if (username !== undefined || password !== undefined) {
4252
this.ui.writeLine(`adding basic auth; username=${username}; password=${password}`);
4353
app.use(basicAuth(username, password));

src/worker.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class Worker {
3737
}
3838

3939
if (!this.httpServer.cache) { this.httpServer.cache = this.cache; }
40+
if (!this.httpServer.gzip) { this.httpServer.gzip = this.gzip; }
4041
if (!this.httpServer.distPath) { this.httpServer.distPath = this.distPath; }
4142
if (!this.httpServer.ui) { this.httpServer.ui = this.ui; }
4243
}

0 commit comments

Comments
 (0)