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){
10 app.use(function(req, res){
11 res.type('foo.js').end('var name = "tj";');
16 .expect('Content-Type', 'application/javascript; charset=utf-8')
20 it('should default to application/octet-stream', function(done){
23 app.use(function(req, res){
24 res.type('rawr').end('var name = "tj";');
29 .expect('Content-Type', 'application/octet-stream', done);
32 it('should set the Content-Type with type/subtype', function(done){
35 app.use(function(req, res){
36 res.type('application/vnd.amazon.ebook')
37 .end('var name = "tj";');
42 .expect('Content-Type', 'application/vnd.amazon.ebook', done);