Skip to content
Myr

res.type.js

This file

Path

test/res.type.js

44 lines · 1.1 KiB · JavaScript

Last changed by

Not known.

History of this file

Take it

The walk stopped after 200 commits: lines older than 6bc7574 point at it.

docs: typo fixesDouglas Christopher Wilsonbefore adoption6bc7574

lines 1–44why, one step back
1
2var express = require('../')3 , request = require('supertest');45describe('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})