Skip to content

Commit

Permalink
feat(web-server): compress responses (gzip/deflate)
Browse files Browse the repository at this point in the history
  • Loading branch information
vojtajina committed Jul 25, 2013
1 parent 7255aa6 commit 8e8a2d4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/web-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,15 @@ var createWebServer = function(injector) {
filesPromise: ['value', filesPromise]
}]);

// TODO(vojta): remove if https://github.com/senchalabs/connect/pull/850 gets merged
var compressOptions = {
filter: function(req, res){
return (/json|text|javascript|dart/).test(res.getHeader('Content-Type'));
}
};

var handler = connect()
.use(connect.compress(compressOptions))
.use(injector.invoke(karmaMiddleware.create))
.use(injector.invoke(sourceFilesMiddleware.create))
// TODO(vojta): extract the proxy into a plugin
Expand Down

0 comments on commit 8e8a2d4

Please sign in to comment.