req.fresh.js
This file
Path
test/req.fresh.js
36 lines · 807 bytes · JavaScript
Last changed by
Merge tag '3.9.0'Douglas Christopher Wilsonbefore adoptiondb4448d
History of this fileTake it
The walk stopped after 200 commits: lines older than 2e68ddb point at it.
expose connect.middleware using Object.getOwnPropertyDescriptor()Jonathan Ongbefore adoption2e68ddb
lines 1–2why, one step back12var express = require('../')remove unnecessary test/support/httpJonathan Ongbefore adoption643397e
line 3why, one step back3 , request = require('supertest');expose connect.middleware using Object.getOwnPropertyDescriptor()Jonathan Ongbefore adoption2e68ddb
lines 4–8why, one step back45describe('req', function(){6 describe('.fresh', function(){7 it('should return true when the resource is not modified', function(done){8 var app = express();Merge tag '3.9.0'Douglas Christopher Wilsonbefore adoptiondb4448d
line 9why, one step back9 var etag = '"12345"';expose connect.middleware using Object.getOwnPropertyDescriptor()Jonathan Ongbefore adoption2e68ddb
lines 10–11why, one step back1011 app.use(function(req, res){Merge tag '3.9.0'Douglas Christopher Wilsonbefore adoptiondb4448d
line 12why, one step back12 res.set('ETag', etag);expose connect.middleware using Object.getOwnPropertyDescriptor()Jonathan Ongbefore adoption2e68ddb
lines 13–17why, one step back13 res.send(req.fresh);14 });1516 request(app)17 .get('/')Merge tag '3.9.0'Douglas Christopher Wilsonbefore adoptiondb4448d
line 18why, one step back18 .set('If-None-Match', etag)expose connect.middleware using Object.getOwnPropertyDescriptor()Jonathan Ongbefore adoption2e68ddb
lines 19–25why, one step back19 .expect(304, done);20 })2122 it('should return false when the resource is modified', function(done){23 var app = express();2425 app.use(function(req, res){Merge tag '3.9.0'Douglas Christopher Wilsonbefore adoptiondb4448d
line 26why, one step back26 res.set('ETag', '"123"');expose connect.middleware using Object.getOwnPropertyDescriptor()Jonathan Ongbefore adoption2e68ddb
lines 27–31why, one step back27 res.send(req.fresh);28 });2930 request(app)31 .get('/')Merge tag '3.9.0'Douglas Christopher Wilsonbefore adoptiondb4448d
lines 32–33why, one step back32 .set('If-None-Match', '"12345"')33 .expect(200, 'false', done);expose connect.middleware using Object.getOwnPropertyDescriptor()Jonathan Ongbefore adoption2e68ddb
lines 34–36why, one step back34 })35 })36})