diff --git a/src/ui/public/courier/fetch/strategy/__tests__/search.js b/src/ui/public/courier/fetch/strategy/__tests__/search.js index 0db84cb7c7ad..f097281c740c 100644 --- a/src/ui/public/courier/fetch/strategy/__tests__/search.js +++ b/src/ui/public/courier/fetch/strategy/__tests__/search.js @@ -20,7 +20,7 @@ describe('ui/courier/fetch/strategy/search', () => { index: ['logstash-123'], type: 'blah', search_type: 'blah2', - body: 'hm this is the body' + body: { foo: 'bar', $foo: 'bar' } } ]; })); @@ -32,6 +32,14 @@ describe('ui/courier/fetch/strategy/search', () => { }); describe('#reqsFetchParamsToBody()', () => { + it('filters out any body properties that begin with $', () => { + let value; + search.reqsFetchParamsToBody(reqsFetchParams).then(val => value = val); + $rootScope.$apply(); + expect(_.includes(value, 'foo')).to.be(true); + expect(_.includes(value, '$foo')).to.be(false); + }); + context('when indexList is not empty', () => { it('includes the index', () => { let value; diff --git a/src/ui/public/courier/fetch/strategy/search.js b/src/ui/public/courier/fetch/strategy/search.js index f7a10923fd9f..a785199181b7 100644 --- a/src/ui/public/courier/fetch/strategy/search.js +++ b/src/ui/public/courier/fetch/strategy/search.js @@ -43,7 +43,7 @@ define(function (require) { ignore_unavailable: true }) + '\n' - + toJson(fetchParams.body || {}, angular.json); + + toJson(fetchParams.body || {}, angular.toJson); }); }) .then(function (requests) {