Skip to content
This repository has been archived by the owner on Jun 2, 2024. It is now read-only.

Commit

Permalink
Merge pull request #156 from cnpm/fix-Disposition
Browse files Browse the repository at this point in the history
fix #155 Content-Disposition wrong.
  • Loading branch information
dead-horse committed Jan 14, 2014
2 parents 28cc13d + adddf0e commit 7be5df8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion controllers/registry/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ exports.download = function (req, res, next) {
res.setHeader('Content-Length', dist.size);
}
res.setHeader('Content-Type', mime.lookup(dist.key));
res.setHeader('Content-Disposition: attachment; filename="' + filename + '"');
res.setHeader('Content-Disposition', 'attachment; filename="' + filename + '"');
res.setHeader('ETag', dist.shasum);

if (nfs.downloadStream) {
Expand Down
6 changes: 2 additions & 4 deletions proxy/npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@ var config = require('../config');
function request(url, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {
dataType: 'json',
timeout: 10000
};
options = null;
}
options = options || {};
options.dataType = options.dataType || 'json';
options.timeout = options.timeout || 120000;
url = config.sourceNpmRegistry + url;
Expand Down
4 changes: 1 addition & 3 deletions test/controllers/registry/module.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,9 +472,7 @@ describe('controllers/registry/module.test.js', function () {
.expect('ETag', 'c61fde5e8c26d053574d0c722097029fd1bc963a')
.expect('Content-Type', 'application/octet-stream')
.expect('Content-Length', '3139')
// TODO supertest has a bug
// Error: expected "Content-Disposition" of "inline; filename="testputmodule-0.1.9.tgz"", got "attachment; filename="testputmodule-0.1.9.tgz": undefined"
// .expect('Content-Disposition', 'inline; filename="testputmodule-0.1.9.tgz"')
.expect('Content-Disposition', 'attachment; filename="cutter-0.0.2.tgz"')
.expect(200)
.end(function (err, res) {
should.not.exist(err);
Expand Down

0 comments on commit 7be5df8

Please sign in to comment.