Skip to content
Myr

always send ETag when content-length > 0

Before adoption: this commit came in with the history the project adopted, so no landing records it.

closes #1780

authored by Jonathan Ong · committed by Jonathan Ong · parent 82a7d7a · Browse files · 2 files+16 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+16 added−1 removed

  • tests:+15 added−0 removed
  • other:+1 added−1 removed

2 files+16 added−1 removed

modified:lib/response.js+1 added-1 removed
130 unmodified lines
131 }132133 // ETag support134 // TODO: W/ support135 if (app.settings.etag && len > 1024 && 'GET' == req.method) {135 if (app.settings.etag && len && 'GET' == req.method) {136 if (!this.get('ETag')) {137 this.set('ETag', etag(body));138 }139 }
663 unmodified lines
modified:test/res.send.js+15 added
319 unmodified lines
320 })321322 describe('"etag" setting', function(){323 describe('when enabled', function(){324 it('should send ETag even when content-length < 1024', function(done){325 var app = express();326327 app.use(function(req, res){328 res.send('kajdslfkasdf');329 });330331 request(app)332 .get('/')333 .end(function(err, res){334 res.headers.should.have.property('etag');335 done();336 });337 })338339 it('should send ETag ', function(done){340 var app = express();341342 app.use(function(req, res){
52 unmodified lines