Permalink
Browse files

Revert "add 'etag' option"

This reverts commit 6f6eec7.
  • Loading branch information...
1 parent 0117464 commit 9bd86cdddc5f78f37f0c33ba7f094977e7aaf0cb @tj tj committed Dec 6, 2012
Showing with 10 additions and 72 deletions.
  1. +0 −1 lib/application.js
  2. +10 −13 lib/response.js
  3. +0 −58 test/res.send.js
View
@@ -47,7 +47,6 @@ app.init = function(){
app.defaultConfiguration = function(){
// default settings
this.enable('x-powered-by');
- this.enable('etag');
this.set('env', process.env.NODE_ENV || 'development');
debug('booting in %s mode', this.get('env'));
View
@@ -82,9 +82,6 @@ res.send = function(body){
, head = 'HEAD' == req.method
, len;
- // settings
- var app = this.app;
-
// allow status / body
if (2 == arguments.length) {
// res.send(body, status) backwards compat
@@ -131,7 +128,7 @@ res.send = function(body){
// ETag support
// TODO: W/ support
- if (app.settings.etag && len > 1024) {
+ if (len > 1024) {
if (!this.get('ETag')) {
this.set('ETag', etag(body));
}
@@ -244,7 +241,7 @@ res.jsonp = function(obj){
/**
* Transfer the file at the given `path`.
- *
+ *
* Automatically sets the _Content-Type_ response header field.
* The callback `fn(err)` is invoked when the transfer is complete
* or when an error occurs. Be sure to check `res.sentHeader`
@@ -266,7 +263,7 @@ res.jsonp = function(obj){
* app.get('/user/:uid/photos/:file', function(req, res){
* var uid = req.params.uid
* , file = req.params.file;
- *
+ *
* req.user.mayViewFilesFrom(uid, function(yes){
* if (yes) {
* res.sendfile('/uploads/' + uid + '/' + file);
@@ -411,11 +408,11 @@ res.type = function(type){
* 'text/plain': function(){
* res.send('hey');
* },
- *
+ *
* 'text/html': function(){
* res.send('<p>hey</p>');
* },
- *
+ *
* 'appliation/json': function(){
* res.send({ message: 'hey' });
* }
@@ -428,11 +425,11 @@ res.type = function(type){
* text: function(){
* res.send('hey');
* },
- *
+ *
* html: function(){
* res.send('<p>hey</p>');
* },
- *
+ *
* json: function(){
* res.send({ message: 'hey' });
* }
@@ -501,15 +498,15 @@ res.attachment = function(filename){
* res.set('Accept', 'application/json');
* res.set({ Accept: 'text/plain', 'X-API-Key': 'tobi' });
*
- * Aliased as `res.header()`.
+ * Aliased as `res.header()`.
*
* @param {String|Object} field
* @param {String} val
* @return {ServerResponse} for chaining
* @api public
*/
-res.set =
+res.set =
res.header = function(field, val){
if (2 == arguments.length) {
this.setHeader(field, '' + val);
@@ -605,7 +602,7 @@ res.cookie = function(name, val, options){
* Mounting:
*
* When an application is mounted, and `res.redirect()`
- * is given a path that does _not_ lead with "/". For
+ * is given a path that does _not_ lead with "/". For
* example suppose a "blog" app is mounted at "/blog",
* the following redirect would result in "/blog/login":
*
View
@@ -298,62 +298,4 @@ describe('res', function(){
.get('/?callback=foo')
.expect('{"foo":"bar"}', done);
})
-
- describe('"etag" setting', function(){
- describe('when enabled', function(){
- it('should send ETag ', function(done){
- var app = express();
-
- app.use(function(req, res){
- var str = Array(1024 * 2).join('-');
- res.send(str);
- });
-
- request(app)
- .get('/')
- .end(function(err, res){
- res.headers.should.have.property('etag', '"-1498647312"');
- done();
- });
- });
- });
-
- describe('when disabled', function(){
- it('should send no ETag', function(done){
- var app = express();
-
- app.use(function(req, res){
- var str = Array(1024 * 2).join('-');
- res.send(str);
- });
-
- app.disable('etag');
-
- request(app)
- .get('/')
- .end(function(err, res){
- res.headers.should.not.have.property('etag');
- done();
- });
- });
-
- it('should send ETag when manually set', function(done){
- var app = express();
-
- app.disable('etag');
-
- app.use(function(req, res){
- res.set('etag', 1);
- res.send(200);
- });
-
- request(app)
- .get('/')
- .end(function(err, res){
- res.headers.should.have.property('etag');
- done();
- });
- });
- });
- })
})

0 comments on commit 9bd86cd

Please sign in to comment.