Skip to content
Myr

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 file

Take 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 back
1
2var express = require('../')

remove unnecessary test/support/httpJonathan Ongbefore adoption643397e

line 3why, one step back
3 , request = require('supertest');

expose connect.middleware using Object.getOwnPropertyDescriptor()Jonathan Ongbefore adoption2e68ddb

lines 4–8why, one step back
4
5describe('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 back
9 var etag = '"12345"';

expose connect.middleware using Object.getOwnPropertyDescriptor()Jonathan Ongbefore adoption2e68ddb

lines 10–11why, one step back
10
11 app.use(function(req, res){

Merge tag '3.9.0'Douglas Christopher Wilsonbefore adoptiondb4448d

line 12why, one step back
12 res.set('ETag', etag);

expose connect.middleware using Object.getOwnPropertyDescriptor()Jonathan Ongbefore adoption2e68ddb

lines 13–17why, one step back
13 res.send(req.fresh);
14 });1516 request(app)17 .get('/')

Merge tag '3.9.0'Douglas Christopher Wilsonbefore adoptiondb4448d

line 18why, one step back
18 .set('If-None-Match', etag)

expose connect.middleware using Object.getOwnPropertyDescriptor()Jonathan Ongbefore adoption2e68ddb

lines 19–25why, one step back
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){

Merge tag '3.9.0'Douglas Christopher Wilsonbefore adoptiondb4448d

line 26why, one step back
26 res.set('ETag', '"123"');

expose connect.middleware using Object.getOwnPropertyDescriptor()Jonathan Ongbefore adoption2e68ddb

lines 27–31why, one step back
27 res.send(req.fresh);
28 });2930 request(app)31 .get('/')

Merge tag '3.9.0'Douglas Christopher Wilsonbefore adoptiondb4448d

lines 32–33why, one step back
32 .set('If-None-Match', '"12345"')
33 .expect(200, 'false', done);

expose connect.middleware using Object.getOwnPropertyDescriptor()Jonathan Ongbefore adoption2e68ddb

lines 34–36why, one step back
34 })
35 })36})