1
0
mirror of https://github.com/seejohnrun/haste-server.git synced 2025-12-13 21:35:56 +00:00

Remove hashlib dependency and switch to mocha for testing

This commit is contained in:
John Crepezzi
2012-01-13 11:16:42 -05:00
parent b251978422
commit 6e4c087319
7 changed files with 42 additions and 65 deletions

View File

@@ -86,9 +86,9 @@ DocumentHandler.prototype.handlePost = function(request, response) {
});
};
// Get a random key that hasn't been already used
// Keep choosing keys until one isn't taken
DocumentHandler.prototype.chooseKey = function(callback) {
var key = this.keyGenerator.createKey(this.keyLength);
var key = this.acceptableKey();
var _this = this;
this.store.get(key, function(ret) {
if (ret) {
@@ -99,4 +99,8 @@ DocumentHandler.prototype.chooseKey = function(callback) {
});
};
DocumentHandler.prototype.acceptableKey = function() {
return this.keyGenerator.createKey(this.keyLength);
};
module.exports = DocumentHandler;