Skip to content

Commit

Permalink
Return json to callbacks since that is what ES sends.
Browse files Browse the repository at this point in the history
Signed-off-by: Nick Campbell <nicholas.j.campbell@gmail.com>
  • Loading branch information
ncb000gt committed Mar 2, 2011
1 parent e5f24b3 commit e287bf4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
2 changes: 1 addition & 1 deletion lib/elasticsearch.js
Expand Up @@ -111,7 +111,7 @@ ElasticSearch.prototype._request = function(opts, data, cb) {
});

if (cb) {
cb(null, buf);
cb(null, JSON.parse(buf.toString()));
}
});
});
Expand Down
3 changes: 0 additions & 3 deletions tests/test-client.js
Expand Up @@ -6,7 +6,6 @@ module.exports = {
var n = 0;
var client = lib.createClient({index:'_all'});
client.status({}, function(err, status) {
status = JSON.parse(status.toString());
assert.ok(status.ok);
n++;
});
Expand All @@ -19,11 +18,9 @@ module.exports = {
var doc = {field1: 'test field', field2: 'second test field'};
var client = lib.createClient({index:'test'});
client.add({type:'info', id:'1'}, doc, function(err, result) {
result = JSON.parse(result.toString());
assert.ok(result.ok);
n++;
client.query({query: {field: {field1: 'test'}}}, function(err, result) {
result = JSON.parse(result.toString());
assert.equal(result.hits.total, 1);
assert.deepEqual(result.hits.hits[0]._source, doc);
n++;
Expand Down

0 comments on commit e287bf4

Please sign in to comment.