misc refactoring

This commit is contained in:
Tj Holowaychuk 2011-05-16 09:32:53 -07:00
parent 3588c1eedc
commit 70e6baf6fc

View File

@ -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;
};