File tree 2 files changed +5
-2
lines changed
2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -176,6 +176,7 @@ res.contentType = function(type){
176
176
*/
177
177
178
178
res . attachment = function ( filename ) {
179
+ if ( filename ) this . contentType ( filename ) ;
179
180
this . header ( 'Content-Disposition' , filename
180
181
? 'attachment; filename="' + path . basename ( filename ) + '"'
181
182
: 'attachment' ) ;
Original file line number Diff line number Diff line change @@ -207,12 +207,14 @@ module.exports = {
207
207
assert . response ( app ,
208
208
{ url : '/javascripts/jquery.js' } ,
209
209
{ body : 'whatever'
210
- , headers : { 'Content-Disposition' : 'attachment; filename="jquery.js"' } } ) ;
210
+ , headers : { 'Content-Type' : 'application/javascript'
211
+ , 'Content-Disposition' : 'attachment; filename="jquery.js"' } } ) ;
211
212
212
213
assert . response ( app ,
213
214
{ url : '/style.css' } ,
214
215
{ body : 'some stylezzz'
215
- , headers : { 'Content-Disposition' : 'attachment' } } ) ;
216
+ , headers : { 'Content-Type' : 'text/html; charset=utf-8'
217
+ , 'Content-Disposition' : 'attachment' } } ) ;
216
218
} ,
217
219
218
220
'test #redirect()' : function ( ) {
You can’t perform that action at this time.
0 commit comments