Skip to content
Myr

Fix incorrect deprecation warnings on res.download

Before adoption: this commit came in with the history the project adopted, so no landing records it.

fixes #2284

authored by Douglas Christopher Wilson · committed by Douglas Christopher Wilson · parent 4aea023 · Browse files · 2 files+12 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+12 added−3 removed

  • other:+12 added−3 removed

2 files+12 added−3 removed

modified:lib/response.js+7 added-3 removed
17 unmodified lines
18var send = require('send');19var basename = path.basename;20var extname = path.extname;21var mime = send.mime;22var resolve = path.resolve;23var vary = require('vary');2425/**26 * Response prototype.
517 unmodified lines
544 *545 * @api public546 */547547res.download = function(path, filename, fn){548res.download = function download(path, filename, fn) {549 // support function as second arg549 if ('function' == typeof filename) {550 if (typeof filename === 'function') {551 fn = filename;552 filename = null;553 }554
3 unmodified lines
558 var headers = {559 'Content-Disposition': contentDisposition(filename)560 };561562 // Resolve the full path for sendFile563 var fullPath = resolve(path);564561 return this.sendfile(path, { headers: headers }, fn);565 return this.sendFile(fullPath, { headers: headers }, fn);566};567568/**569 * Set _Content-Type_ response header with `type` through `mime.lookup()`
387 unmodified lines
modified:History.md+5 added
1unreleased2==========34 * fix incorrect deprecation warnings on `res.download`564.8.0 / 2014-08-057==================89 * add `res.sendFile`
1982 unmodified lines