return headers

This commit is contained in:
Matias Alejo Garcia 2014-12-01 16:19:34 -03:00
parent 67fd6344dd
commit b096fd50a7
5 changed files with 10 additions and 10 deletions

View File

@ -18,6 +18,7 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc
$scope.done = function() {
$rootScope.starting = false;
$rootScope.$digest();
};
@ -46,7 +47,7 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc
} else {
$scope.error = 'Unknown error';
}
$scope.done();
return $scope.done();
}
if (iden) {

View File

@ -122,7 +122,7 @@ Identity.open = function(opts, cb) {
var storage = opts.storage || opts.pluginManager.get('DB');
storage.setCredentials(opts.email, opts.password, opts);
storage.getItem(Identity.getKeyForEmail(opts.email), function(err, data) {
storage.getItem(Identity.getKeyForEmail(opts.email), function(err, data, headers) {
var exported;
if (err) {
return cb(err);
@ -132,7 +132,7 @@ Identity.open = function(opts, cb) {
} catch (e) {
return cb(e);
}
return cb(null, new Identity(_.extend(opts, exported)));
return cb(null, new Identity(_.extend(opts, exported)), headers);
});
};

View File

@ -20,7 +20,7 @@ EncryptedInsightStorage.prototype._brokenDecrypt = function(body) {
EncryptedInsightStorage.prototype.getItem = function(name, callback) {
var self = this;
InsightStorage.prototype.getItem.apply(this, [name,
function(err, body) {
function(err, body, headers) {
if (err) {
return callback(err);
}
@ -35,7 +35,7 @@ EncryptedInsightStorage.prototype.getItem = function(name, callback) {
log.debug('Could not decrypt value.');
return callback('PNOTFOUND');
}
return callback(null, decryptedJson);
return callback(null, decryptedJson, headers);
}
]);
};

View File

@ -46,12 +46,12 @@ InsightStorage.prototype.getItem = function(name, callback) {
var passphrase = this.getPassphrase();
var self = this;
this._makeGetRequest(passphrase, name, function(err, body) {
this._makeGetRequest(passphrase, name, function(err, body, headers) {
if (err) log.warn(err);
if (err && err.indexOf('PNOTFOUND') !== -1 && mayBeOldPassword(self.password)) {
return self._brokenGetItem(name, callback);
}
return callback(err, body);
return callback(err, body, headers);
});
};
@ -87,7 +87,6 @@ InsightStorage.prototype._makeGetRequest = function(passphrase, key, callback) {
};
this.request.get(getParams,
function(err, response, body) {
console.log('[InsightStorage.js.89:response:]',response); //TODO
if (err) {
return callback('Connection error');
}
@ -97,7 +96,7 @@ console.log('[InsightStorage.js.89:response:]',response); //TODO
if (response.statusCode !== 200) {
return callback('Connection error');
}
return callback(null, body);
return callback(null, body, response.getAllResponseHeaders());
}
);
};

View File

@ -79,7 +79,7 @@ angular.module('copayApp.services')
passphraseConfig: config.passphraseConfig,
};
copay.Identity.open(opts, function(err, iden) {
copay.Identity.open(opts, function(err, iden, headers) {
if (err) return cb(err);
root.bind(iden);
return cb(null, iden);