You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2013/08/30 01:19:47 UTC

git commit: CB-4492 updated download tracking

Updated Branches:
  refs/heads/master cfa431bc0 -> 479d339d2


CB-4492 updated download tracking


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/479d339d
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/479d339d
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/479d339d

Branch: refs/heads/master
Commit: 479d339d28941ec0faa47c02170ea46e66e072a7
Parents: cfa431b
Author: Anis Kadri <an...@apache.org>
Authored: Thu Aug 29 16:19:47 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Thu Aug 29 16:19:47 2013 -0700

----------------------------------------------------------------------
 src/registry/registry.js | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/479d339d/src/registry/registry.js
----------------------------------------------------------------------
diff --git a/src/registry/registry.js b/src/registry/registry.js
index 1ab5de1..ba22520 100644
--- a/src/registry/registry.js
+++ b/src/registry/registry.js
@@ -34,7 +34,7 @@ function getPackageInfo(args, cb) {
     
     http.get(settings.registry + '/' + name + '/' + version, function(res) {
          if(res.statusCode != 200) {
-                 var err = new Error('Error');
+                 var err = new Error('error: Could not fetch package information for '+name);
                  if (cb) cb(err);
                  else throw err;
          } else {
@@ -80,13 +80,14 @@ function fetchPackage(info, cb) {
                 // (for lacking a _rev), and dropped a download count is not important.
                 var now = new Date();
                 var pkgId = info._id.substring(0, info._id.indexOf('@'));
-                var id = pkgId + '_' + now.toISOString();
                 var uri = url.parse(module.exports.settings.registry);
                 // Overriding the path to point at /downloads.
-                uri.path = '/downloads/' + id;
-                uri.method = 'PUT';
+                uri.path = '/downloads';
+                uri.method = 'POST';
                 var dlcReq = http.request(uri);
 
+                dlcReq.setHeader('Content-Type', 'application/json');
+
                 dlcReq.write(JSON.stringify({
                     day: now.getUTCFullYear() + '-' + (now.getUTCMonth()+1) + '-' + now.getUTCDate(),
                     pkg: pkgId