Skip to content
Myr

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 file

Take it

The walk stopped after 200 commits: lines older than 6bc7574 point at it.

docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574

line 1why, one step back
1

Merge tag '3.19.1'Douglas Christopher Wilsonbefore adoption82689d6

lines 2–3why, one step back
2var express = require('..');
3var request = require('supertest');

docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574

lines 4–6why, one step back
4
5describe('res', function(){6 describe('.links(obj)', function(){

Merge tag '3.19.1'Douglas Christopher Wilsonbefore adoption82689d6

lines 7–15why, one step back
7 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 back
16 });
17

Merge tag '3.19.1'Douglas Christopher Wilsonbefore adoption82689d6

lines 18–21why, one step back
18 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 back
22 })
23

Merge tag '3.19.1'Douglas Christopher Wilsonbefore adoption82689d6

lines 24–25why, one step back
24 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 back
26

Merge tag '3.19.1'Douglas Christopher Wilsonbefore adoption82689d6

lines 27–37why, one step back
27 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 back
38 });
39

Merge tag '3.19.1'Douglas Christopher Wilsonbefore adoption82689d6

lines 40–43why, one step back
40 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 back
44 })
45 })46})