add some debug messages
This commit is contained in:
parent
dd61c1b5b3
commit
e0969cd95c
1 changed files with 14 additions and 13 deletions
|
|
@ -47,7 +47,7 @@ InsightStorage.prototype.getItem = function(name, callback) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
this._makeGetRequest(passphrase, name, function(err, body) {
|
this._makeGetRequest(passphrase, name, function(err, body) {
|
||||||
console.log('[InsightStorage.js.49:err:]',err); //TODO
|
if (err) log.info('[InsightStorage. err]', err);
|
||||||
if (err && err.indexOf('PNOTFOUND') !== -1 && mayBeOldPassword(self.password)) {
|
if (err && err.indexOf('PNOTFOUND') !== -1 && mayBeOldPassword(self.password)) {
|
||||||
return self._brokenGetItem(name, callback);
|
return self._brokenGetItem(name, callback);
|
||||||
}
|
}
|
||||||
|
|
@ -71,21 +71,22 @@ InsightStorage.prototype.getKey = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
InsightStorage.prototype.getPassphrase = function() {
|
InsightStorage.prototype.getPassphrase = function() {
|
||||||
return bitcore.util.twoSha256(this.getKey()).toString('base64');
|
return bitcore.util.twoSha256(this.getKey()).toString('base64');
|
||||||
};
|
};
|
||||||
|
|
||||||
InsightStorage.prototype._makeGetRequest = function(passphrase, key, callback) {
|
InsightStorage.prototype._makeGetRequest = function(passphrase, key, callback) {
|
||||||
var authHeader = new buffers.Buffer(this.email + ':' + passphrase).toString('base64');
|
var authHeader = new buffers.Buffer(this.email + ':' + passphrase).toString('base64');
|
||||||
var retrieveUrl = this.storeUrl + '/retrieve';
|
var retrieveUrl = this.storeUrl + '/retrieve';
|
||||||
log.debug(retrieveUrl);
|
var getParams = {
|
||||||
this.request.get({
|
url: retrieveUrl + '?' + querystring.encode({
|
||||||
url: retrieveUrl + '?' + querystring.encode({
|
key: key
|
||||||
key: key
|
}),
|
||||||
}),
|
headers: {
|
||||||
headers: {
|
'Authorization': authHeader
|
||||||
'Authorization': authHeader
|
}
|
||||||
}
|
};
|
||||||
},
|
log.debug('Insight request', getParams);
|
||||||
|
this.request.get(getParams,
|
||||||
function(err, response, body) {
|
function(err, response, body) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return callback('Connection error');
|
return callback('Connection error');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue