Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

renamed Deflate middleware to Gzip

  • Loading branch information...
commit 6b5df9346c1533048b10db5eb71adbea2b4a216d 1 parent 5ddf550
@nrstott authored
View
4 examples/gzip-response.js
@@ -5,9 +5,9 @@ router.get('/', function() {
return bogart.html('<h1>This response is compressed by the Deflate middleware!</h1>');
});
-var Deflate = bogart.middleware.Deflate;
+var Deflate = bogart.middleware.Gzip;
-var app = Deflate(router);
+var app = Gzip(router);
bogart.start(app);
View
4 lib/middleware.js
@@ -59,14 +59,14 @@ exports.ParseForm = function(nextApp) {
}
};
-exports.Deflate = function(nextApp) {
+exports.Gzip = function(nextApp) {
var deflate = require('deflate')
, bogart = require('./bogart');
function acceptsGzip(req) {
var encodings;
- if (!req.headers['accept-encoding']) {
+ if (!req.headers || !req.headers['accept-encoding']) {
return false;
}
View
6 test/middleware.test.js
@@ -81,15 +81,15 @@ exports["test method override"] = function(beforeExit) {
});
};
-exports["test deflate"] = function(beforeExit) {
+exports["test gzip"] = function(beforeExit) {
var response = null;
- var app = bogart.middleware.Deflate(function(req) {
+ var app = bogart.middleware.Gzip(function(req) {
return bogart.html('Hello World');
});
var appPromise = app({ method: 'GET', env: {} });
- appPromise.then(function(jsgiResp) {
+ Q.when(appPromise, function(jsgiResp) {
response = jsgiResp;
});
Please sign in to comment.
Something went wrong with that request. Please try again.