2 var request = require('supertest')
3 , app = require('../../examples/content-negotiation');
5 describe('content-negotiation', function(){
6 describe('GET /', function(){
7 it('should default to text/html', function(done){
10 .expect(200, '<ul><li>Tobi</li><li>Loki</li><li>Jane</li></ul>', done)
13 it('should accept to text/plain', function(done){
16 .set('Accept', 'text/plain')
17 .expect(200, ' - Tobi\n - Loki\n - Jane\n', done)
20 it('should accept to application/json', function(done){
23 .set('Accept', 'application/json')
24 .expect(200, '[{"name":"Tobi"},{"name":"Loki"},{"name":"Jane"}]', done)
28 describe('GET /users', function(){
29 it('should default to text/html', function(done){
32 .expect(200, '<ul><li>Tobi</li><li>Loki</li><li>Jane</li></ul>', done)
35 it('should accept to text/plain', function(done){
38 .set('Accept', 'text/plain')
39 .expect(200, ' - Tobi\n - Loki\n - Jane\n', done)
42 it('should accept to application/json', function(done){
45 .set('Accept', 'application/json')
46 .expect(200, '[{"name":"Tobi"},{"name":"Loki"},{"name":"Jane"}]', done)