mirror of
https://github.com/zebrajr/express.git
synced 2025-12-06 12:19:51 +01:00
misc refactoring
This commit is contained in:
parent
3588c1eedc
commit
70e6baf6fc
|
|
@ -17,8 +17,9 @@ var fs = require('fs')
|
|||
, parseRange = require('./utils').parseRange
|
||||
, res = http.ServerResponse.prototype
|
||||
, send = connect.static.send
|
||||
, join = require('path').join
|
||||
, mime = require('mime');
|
||||
, mime = require('mime')
|
||||
, basename = path.basename
|
||||
, join = path.join;
|
||||
|
||||
/**
|
||||
* Send a response with the given `body` and optional `headers` and `status` code.
|
||||
|
|
@ -180,7 +181,7 @@ res.contentType = function(type){
|
|||
res.attachment = function(filename){
|
||||
if (filename) this.contentType(filename);
|
||||
this.header('Content-Disposition', filename
|
||||
? 'attachment; filename="' + path.basename(filename) + '"'
|
||||
? 'attachment; filename="' + basename(filename) + '"'
|
||||
: 'attachment');
|
||||
return this;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user