Skip to content
Myr

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 file

Take it

The walk stopped after 200 commits: lines older than 34c83d7 point at it.

3.4.7Jonathan Ongbefore adoption34c83d7

lines 1–2why, one step back
1
2var express = require('../')

remove unnecessary test/support/httpJonathan Ongbefore adoption643397e

line 3why, one step back
3 , request = require('supertest');

3.4.7Jonathan Ongbefore adoption34c83d7

lines 4–44why, one step back
4
5describe('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})