mirror of
https://github.com/zebrajr/express.git
synced 2025-12-06 00:19:48 +01:00
parent
82a7d7a977
commit
55d1a4f964
|
|
@ -132,7 +132,7 @@ res.send = function(body){
|
|||
|
||||
// ETag support
|
||||
// TODO: W/ support
|
||||
if (app.settings.etag && len > 1024 && 'GET' == req.method) {
|
||||
if (app.settings.etag && len && 'GET' == req.method) {
|
||||
if (!this.get('ETag')) {
|
||||
this.set('ETag', etag(body));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -321,6 +321,21 @@ describe('res', function(){
|
|||
|
||||
describe('"etag" setting', function(){
|
||||
describe('when enabled', function(){
|
||||
it('should send ETag even when content-length < 1024', function(done){
|
||||
var app = express();
|
||||
|
||||
app.use(function(req, res){
|
||||
res.send('kajdslfkasdf');
|
||||
});
|
||||
|
||||
request(app)
|
||||
.get('/')
|
||||
.end(function(err, res){
|
||||
res.headers.should.have.property('etag');
|
||||
done();
|
||||
});
|
||||
})
|
||||
|
||||
it('should send ETag ', function(done){
|
||||
var app = express();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user