3 var express = require('..');
4 var request = require('supertest');
6 describe('res', function(){
7 describe('.links(obj)', function(){
8 it('should set Link header field', function (done) {
11 app.use(function (req, res) {
13 next: 'http://api.example.com/users?page=2',
14 last: 'http://api.example.com/users?page=5'
21 .expect('Link', '<http://api.example.com/users?page=2>; rel="next", <http://api.example.com/users?page=5>; rel="last"')
25 it('should set Link header field for multiple calls', function (done) {
28 app.use(function (req, res) {
30 next: 'http://api.example.com/users?page=2',
31 last: 'http://api.example.com/users?page=5'
35 prev: 'http://api.example.com/users?page=1'
43 .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"')