Clean up some code and move document stores into subfolder
This commit is contained in:
parent
483fce891d
commit
f37d1ad401
10 changed files with 92 additions and 44 deletions
|
@ -54,13 +54,15 @@ DocumentHandler.prototype.handlePost = function(request, response) {
|
|||
request.on('data', function(data) {
|
||||
if (!buffer) {
|
||||
response.writeHead(200, { 'content-type': 'application/json' });
|
||||
}
|
||||
}
|
||||
buffer += data.toString();
|
||||
if (_this.maxLength && buffer.length > _this.maxLength) {
|
||||
cancelled = true;
|
||||
winston.warn('document >maxLength', { maxLength: _this.maxLength });
|
||||
response.writeHead(400, { 'content-type': 'application/json' });
|
||||
response.end(JSON.stringify({ message: 'Document exceeds maximum length.' }));
|
||||
response.end(
|
||||
JSON.stringify({ message: 'Document exceeds maximum length.' })
|
||||
);
|
||||
}
|
||||
});
|
||||
request.on('end', function(end) {
|
||||
|
@ -96,7 +98,7 @@ DocumentHandler.prototype.chooseKey = function(callback) {
|
|||
} else {
|
||||
callback(key);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
DocumentHandler.prototype.acceptableKey = function() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue