diff options
Diffstat (limited to 'deps/npm/node_modules/npm-registry-client/lib')
4 files changed, 12 insertions, 9 deletions
diff --git a/deps/npm/node_modules/npm-registry-client/lib/access.js b/deps/npm/node_modules/npm-registry-client/lib/access.js index ff01e95e28..b33d8973f3 100644 --- a/deps/npm/node_modules/npm-registry-client/lib/access.js +++ b/deps/npm/node_modules/npm-registry-client/lib/access.js @@ -125,6 +125,7 @@ function accessAssertions (subcommand, uri, params, cb) { function typeChecks (specs) { Object.keys(specs).forEach(function (key) { var checks = specs[key] + /* eslint valid-typeof:0 */ assert(typeof checks[0] === checks[1], key + ' is required and must be of type ' + checks[1]) }) diff --git a/deps/npm/node_modules/npm-registry-client/lib/adduser.js b/deps/npm/node_modules/npm-registry-client/lib/adduser.js index fd6f5302ae..0dd517d946 100644 --- a/deps/npm/node_modules/npm-registry-client/lib/adduser.js +++ b/deps/npm/node_modules/npm-registry-client/lib/adduser.js @@ -29,7 +29,7 @@ function adduser (uri, params, cb) { if (!username) return cb(new Error('No username supplied.')) if (!password) return cb(new Error('No password supplied.')) if (!email) return cb(new Error('No email address supplied.')) - if (!email.match(/^[^@]+@[^\.]+\.[^\.]+/)) { + if (!email.match(/^[^@]+@[^.]+\.[^.]+/)) { return cb(new Error('Please use a real email address.')) } @@ -111,7 +111,7 @@ function adduser (uri, params, cb) { client.log.verbose('adduser', 'back', [error, data, json]) if (!error) { error = new Error( - (response && response.statusCode || '') + ' ' + + ((response && response.statusCode) || '') + ' ' + 'Could not create user\n' + JSON.stringify(data) ) } diff --git a/deps/npm/node_modules/npm-registry-client/lib/ping.js b/deps/npm/node_modules/npm-registry-client/lib/ping.js index b90f99d116..5ab98c52d2 100644 --- a/deps/npm/node_modules/npm-registry-client/lib/ping.js +++ b/deps/npm/node_modules/npm-registry-client/lib/ping.js @@ -11,11 +11,9 @@ function ping (uri, params, cb) { var auth = params.auth assert(auth && typeof auth === 'object', 'must pass auth to ping') - this.request(url.resolve(uri, '-/ping?write=true'), { auth: auth }, function (er, fullData) { - if (er) { - cb(er) - } else if (fullData) { - cb(null, fullData) + this.request(url.resolve(uri, '-/ping?write=true'), { auth: auth }, function (er, fullData, data, response) { + if (er || fullData) { + cb(er, fullData, data, response) } else { cb(new Error('No data received')) } diff --git a/deps/npm/node_modules/npm-registry-client/lib/request.js b/deps/npm/node_modules/npm-registry-client/lib/request.js index 8d456259a7..e96c47ef0c 100644 --- a/deps/npm/node_modules/npm-registry-client/lib/request.js +++ b/deps/npm/node_modules/npm-registry-client/lib/request.js @@ -111,13 +111,17 @@ function makeRequest (uri, params, cb_) { // metadata should be compressed headers['accept-encoding'] = 'gzip' + // metadata should be minified, if the registry supports it + var er = this.authify(params.authed, parsed, headers, params.auth) if (er) return cb_(er) + var useCorgi = params.fullMetadata == null ? false : !params.fullMetadata + var opts = this.initialize( parsed, params.method, - 'application/json', + useCorgi ? 'application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*' : 'application/json', headers ) @@ -269,7 +273,7 @@ function requestDone (method, where, cb) { } // for the search endpoint, the 'error' property can be an object - if (parsed && parsed.error && typeof parsed.error !== 'object' || + if ((parsed && parsed.error && typeof parsed.error !== 'object') || response.statusCode >= 400) { var w = url.parse(where).pathname.substr(1) var name |