From 1556ce195a7a110cd1f2add43f329a4f70fc2eca Mon Sep 17 00:00:00 2001 From: Alex Kocharin Date: Wed, 2 Oct 2013 22:01:18 +0400 Subject: [PATCH] npm star/unstar calls now return proper error --- lib/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/index.js b/lib/index.js index 2f8f5d3b1..343e179de 100644 --- a/lib/index.js +++ b/lib/index.js @@ -135,6 +135,15 @@ module.exports = function(config_hash) { // publishing a package app.put('/:package', can('publish'), media('application/json'), expect_json, function(req, res, next) { var name = req.params.package; + + if (Object.keys(req.body).length == 1 && typeof(req.body.users) === 'object') { + return next(new UError({ + // 501 status is more meaningful, but npm doesn't show error message for 5xx + status: 404, + msg: 'npm star|unstar calls are not implemented', + })); + } + try { var metadata = utils.validate_metadata(req.body, name); } catch(err) {