diff --git a/controllers/registry/module.js b/controllers/registry/module.js index 09822c5b2..fd425ee09 100644 --- a/controllers/registry/module.js +++ b/controllers/registry/module.js @@ -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) { diff --git a/proxy/npm.js b/proxy/npm.js index f1b9e47db..c7957cfb2 100644 --- a/proxy/npm.js +++ b/proxy/npm.js @@ -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; diff --git a/test/controllers/registry/module.test.js b/test/controllers/registry/module.test.js index d9106861b..4299cf05f 100644 --- a/test/controllers/registry/module.test.js +++ b/test/controllers/registry/module.test.js @@ -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);