@@ -147,16 +147,23 @@ describe('send(file).pipe(res)', function () {
147147 it ( 'should set Content-Type via mime map' , function ( done ) {
148148 request ( app )
149149 . get ( '/name.txt' )
150- . expect ( 'Content-Type' , 'text/plain; charset=UTF -8' )
150+ . expect ( 'Content-Type' , 'text/plain; charset=utf -8' )
151151 . expect ( 200 , function ( err ) {
152152 if ( err ) return done ( err )
153153 request ( app )
154154 . get ( '/tobi.html' )
155- . expect ( 'Content-Type' , 'text/html; charset=UTF -8' )
155+ . expect ( 'Content-Type' , 'text/html; charset=utf -8' )
156156 . expect ( 200 , done )
157157 } )
158158 } )
159159
160+ it ( 'should default Content-Type to octet-stream' , function ( done ) {
161+ request ( app )
162+ . get ( '/no_ext' )
163+ . expect ( 'Content-Type' , 'application/octet-stream' )
164+ . expect ( 200 , done )
165+ } )
166+
160167 it ( 'should 404 if file disappears after stat, before open' , function ( done ) {
161168 var app = http . createServer ( function ( req , res ) {
162169 send ( req , req . url , { root : 'test/fixtures' } )
@@ -1281,40 +1288,6 @@ describe('send(file, options)', function () {
12811288 } )
12821289} )
12831290
1284- describe ( 'send.mime' , function ( ) {
1285- it ( 'should be exposed' , function ( ) {
1286- assert . ok ( send . mime )
1287- } )
1288-
1289- describe ( '.default_type' , function ( ) {
1290- before ( function ( ) {
1291- this . default_type = send . mime . default_type
1292- } )
1293-
1294- afterEach ( function ( ) {
1295- send . mime . default_type = this . default_type
1296- } )
1297-
1298- it ( 'should change the default type' , function ( done ) {
1299- send . mime . default_type = 'text/plain'
1300-
1301- request ( createServer ( { root : fixtures } ) )
1302- . get ( '/no_ext' )
1303- . expect ( 'Content-Type' , 'text/plain; charset=UTF-8' )
1304- . expect ( 200 , done )
1305- } )
1306-
1307- it ( 'should not add Content-Type for undefined default' , function ( done ) {
1308- send . mime . default_type = undefined
1309-
1310- request ( createServer ( { root : fixtures } ) )
1311- . get ( '/no_ext' )
1312- . expect ( shouldNotHaveHeader ( 'Content-Type' ) )
1313- . expect ( 200 , done )
1314- } )
1315- } )
1316- } )
1317-
13181291function createServer ( opts , fn ) {
13191292 return http . createServer ( function onRequest ( req , res ) {
13201293 try {
0 commit comments