0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-01-13 22:48:31 -05:00

npm star/unstar calls now return proper error

This commit is contained in:
Alex Kocharin 2013-10-02 22:01:18 +04:00
parent 2675196672
commit 1556ce195a

View file

@ -135,6 +135,15 @@ module.exports = function(config_hash) {
// publishing a package // publishing a package
app.put('/:package', can('publish'), media('application/json'), expect_json, function(req, res, next) { app.put('/:package', can('publish'), media('application/json'), expect_json, function(req, res, next) {
var name = req.params.package; 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 { try {
var metadata = utils.validate_metadata(req.body, name); var metadata = utils.validate_metadata(req.body, name);
} catch(err) { } catch(err) {