res.links.js
This file
Path
test/res.links.js
46 lines · 1.2 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
line 1why, one step back1Merge tag '3.19.1'Douglas Christopher Wilsonbefore adoption82689d6
lines 2–3why, one step back2var express = require('..');3var request = require('supertest');docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574
lines 4–6why, one step back45describe('res', function(){6 describe('.links(obj)', function(){Merge tag '3.19.1'Douglas Christopher Wilsonbefore adoption82689d6
lines 7–15why, one step back7 it('should set Link header field', function (done) {8 var app = express();910 app.use(function (req, res) {11 res.links({12 next: 'http://api.example.com/users?page=2',13 last: 'http://api.example.com/users?page=5'14 });15 res.end();docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574
lines 16–17why, one step back16 });17Merge tag '3.19.1'Douglas Christopher Wilsonbefore adoption82689d6
lines 18–21why, one step back18 request(app)19 .get('/')20 .expect('Link', '<http://api.example.com/users?page=2>; rel="next", <http://api.example.com/users?page=5>; rel="last"')21 .expect(200, done);docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574
lines 22–23why, one step back22 })23Merge tag '3.19.1'Douglas Christopher Wilsonbefore adoption82689d6
lines 24–25why, one step back24 it('should set Link header field for multiple calls', function (done) {25 var app = express();docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574
line 26why, one step back26Merge tag '3.19.1'Douglas Christopher Wilsonbefore adoption82689d6
lines 27–37why, one step back27 app.use(function (req, res) {28 res.links({29 next: 'http://api.example.com/users?page=2',30 last: 'http://api.example.com/users?page=5'31 });3233 res.links({34 prev: 'http://api.example.com/users?page=1'35 });3637 res.end();docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574
lines 38–39why, one step back38 });39Merge tag '3.19.1'Douglas Christopher Wilsonbefore adoption82689d6
lines 40–43why, one step back40 request(app)41 .get('/')42 .expect('Link', '<http://api.example.com/users?page=2>; rel="next", <http://api.example.com/users?page=5>; rel="last", <http://api.example.com/users?page=1>; rel="prev"')43 .expect(200, done);docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574
lines 44–46why, one step back44 })45 })46})