req.fresh.js
This file
Path
test/req.fresh.js
49 lines · 1.1 KiB · JavaScript
Last changed by
Merge tag '3.19.1'Douglas Christopher Wilsonbefore adoption82689d6
History of this fileTake it
The walk stopped after 200 commits: lines older than 6bc7574 point at it.
docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574
lines 1–34why, one step back12var express = require('../')3 , request = require('supertest');45describe('req', function(){6 describe('.fresh', function(){7 it('should return true when the resource is not modified', function(done){8 var app = express();9 var etag = '"12345"';1011 app.use(function(req, res){12 res.set('ETag', etag);13 res.send(req.fresh);14 });1516 request(app)17 .get('/')18 .set('If-None-Match', etag)19 .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){26 res.set('ETag', '"123"');27 res.send(req.fresh);28 });2930 request(app)31 .get('/')32 .set('If-None-Match', '"12345"')33 .expect(200, 'false', done);34 })Merge tag '3.18.6'Douglas Christopher Wilsonbefore adoption4aa2801
lines 35–39why, one step back3536 it('should return false without response headers', function(done){37 var app = express();3839 app.use(function(req, res){Merge tag '3.19.1'Douglas Christopher Wilsonbefore adoption82689d6
line 40why, one step back40 res._headers = null;Merge tag '3.18.6'Douglas Christopher Wilsonbefore adoption4aa2801
lines 41–47why, one step back41 res.send(req.fresh);42 });4344 request(app)45 .get('/')46 .expect(200, 'false', done);47 })docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574
lines 48–49why, one step back48 })49})