docs: add note about security report location
[express.git] / test / res.type.js
blobcc1dd08d410054de3e4f7024bc9c882197e488d3
2 var express = require('../')
3   , request = require('supertest');
5 describe('res', function(){
6   describe('.type(str)', function(){
7     it('should set the Content-Type based on a filename', function(done){
8       var app = express();
10       app.use(function(req, res){
11         res.type('foo.js').end('var name = "tj";');
12       });
14       request(app)
15       .get('/')
16       .expect('Content-Type', 'application/javascript; charset=utf-8')
17       .end(done)
18     })
20     it('should default to application/octet-stream', function(done){
21       var app = express();
23       app.use(function(req, res){
24         res.type('rawr').end('var name = "tj";');
25       });
27       request(app)
28       .get('/')
29       .expect('Content-Type', 'application/octet-stream', done);
30     })
32     it('should set the Content-Type with type/subtype', function(done){
33       var app = express();
35       app.use(function(req, res){
36         res.type('application/vnd.amazon.ebook')
37           .end('var name = "tj";');
38       });
40       request(app)
41       .get('/')
42       .expect('Content-Type', 'application/vnd.amazon.ebook', done);
43     })
44   })