res.type.js
This file
Path
test/res.type.js
44 lines · 1.1 KiB · JavaScript
Last changed by
remove unnecessary test/support/httpJonathan Ongbefore adoption643397e
History of this fileTake it
The walk stopped after 200 commits: lines older than 2e68ddb point at it.
expose connect.middleware using Object.getOwnPropertyDescriptor()Jonathan Ongbefore adoption2e68ddb
lines 1–2why, one step back12var express = require('../')remove unnecessary test/support/httpJonathan Ongbefore adoption643397e
line 3why, one step back3 , request = require('supertest');expose connect.middleware using Object.getOwnPropertyDescriptor()Jonathan Ongbefore adoption2e68ddb
lines 4–44why, one step back45describe('res', function(){6 describe('.type(str)', function(){7 it('should set the Content-Type based on a filename', function(done){8 var app = express();910 app.use(function(req, res){11 res.type('foo.js').end('var name = "tj";');12 });1314 request(app)15 .get('/')16 .expect('Content-Type', 'application/javascript', done);17 })1819 it('should default to application/octet-stream', function(done){20 var app = express();2122 app.use(function(req, res){23 res.type('rawr').end('var name = "tj";');24 });2526 request(app)27 .get('/')28 .expect('Content-Type', 'application/octet-stream', done);29 })3031 it('should set the Content-Type with type/subtype', function(done){32 var app = express();3334 app.use(function(req, res){35 res.type('application/vnd.amazon.ebook')36 .end('var name = "tj";');37 });3839 request(app)40 .get('/')41 .expect('Content-Type', 'application/vnd.amazon.ebook', done);42 })43 })44})