From 4ef2085aef5d64cb0b799b0cf665e1d1d6e491be Mon Sep 17 00:00:00 2001 From: Yoann Abbes Date: Fri, 15 Nov 2019 11:42:02 +0100 Subject: [PATCH 01/37] wip --- src/Kuzzle.js | 4 ++-- src/protocols/abstract/common.js | 4 ++-- src/protocols/http.js | 7 +++++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Kuzzle.js b/src/Kuzzle.js index 1a37f1727..f22ebb874 100644 --- a/src/Kuzzle.js +++ b/src/Kuzzle.js @@ -407,7 +407,7 @@ class Kuzzle extends KuzzleEventEmitter { } // we follow the api but allow some more logical "mistakes" (the only allowed value for refresh arg is "wait_for") - if (request.refresh) { + if (request.refresh || options.refresh) { request.refresh = 'wait_for'; } @@ -458,7 +458,7 @@ class Kuzzle extends KuzzleEventEmitter { Discarded request: ${JSON.stringify(request)}`)); } - return this.protocol.query(request); + return this.protocol.query(request, options); } /** diff --git a/src/protocols/abstract/common.js b/src/protocols/abstract/common.js index 8eec74705..42ff10053 100644 --- a/src/protocols/abstract/common.js +++ b/src/protocols/abstract/common.js @@ -80,7 +80,7 @@ class AbstractWrapper extends KuzzleEventEmitter { this.clear(); } - query (request) { + query (request, options) { if (!this.isReady()) { this.emit('discarded', request); return Promise.reject(new Error(`Unable to execute request: not connected to a Kuzzle server. @@ -108,7 +108,7 @@ Discarded request: ${JSON.stringify(request)}`)); pending.resolve(response); }); - this.send(request); + this.send(request, options); return pending.promise; } diff --git a/src/protocols/http.js b/src/protocols/http.js index cff3e36d6..2a58bdfc3 100644 --- a/src/protocols/http.js +++ b/src/protocols/http.js @@ -135,7 +135,7 @@ class HttpWrapper extends KuzzleAbstractProtocol { * @param {Object} data * @returns {Promise} */ - send (data) { + send (data, options) { const payload = { action: undefined, @@ -181,7 +181,10 @@ class HttpWrapper extends KuzzleAbstractProtocol { return; } - + + if (options.verbOverride) { + route.verb = options.verbOverride; + } const method = route.verb, regex = /\/:([^/]*)/; From 1c9af678a958552d8f17e5ccb30ec21aeb63512f Mon Sep 17 00:00:00 2001 From: Yoann Abbes Date: Fri, 15 Nov 2019 13:45:58 +0100 Subject: [PATCH 02/37] wip --- src/protocols/http.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/protocols/http.js b/src/protocols/http.js index 2a58bdfc3..9679315b9 100644 --- a/src/protocols/http.js +++ b/src/protocols/http.js @@ -322,7 +322,7 @@ class HttpWrapper extends KuzzleAbstractProtocol { function getCorrectRoute (routes) { let shortestRoute = routes[0], - postRoute, + getRoute, minLength = routes[0].url.length, sameLength = true; @@ -336,14 +336,14 @@ function getCorrectRoute (routes) { minLength = route.url.length; } - if (route.verb === 'POST') { - postRoute = route; + if (route.verb === 'GET') { + getRoute = route; } } if (sameLength) { // with same URL size, we keep the POST route - return postRoute; + return getRoute; } // with differents URL sizes, we keep the shortest because URL params From 86e632fac8aa8b85e106a4c8e62e470627616e09 Mon Sep 17 00:00:00 2001 From: Yoann Abbes Date: Fri, 15 Nov 2019 13:54:40 +0100 Subject: [PATCH 03/37] wip --- src/protocols/http.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/protocols/http.js b/src/protocols/http.js index 9679315b9..df3ac05f2 100644 --- a/src/protocols/http.js +++ b/src/protocols/http.js @@ -182,11 +182,11 @@ class HttpWrapper extends KuzzleAbstractProtocol { return; } - if (options.verbOverride) { - route.verb = options.verbOverride; - } + // if (options.verbOverride) { + // route.verb = options.verbOverride; + // } const - method = route.verb, + method = 'GET',//route.verb, regex = /\/:([^/]*)/; let From 553ebdae814e1b994cf05a50d93ff1f3eff316c9 Mon Sep 17 00:00:00 2001 From: Yoann Abbes Date: Fri, 15 Nov 2019 14:01:51 +0100 Subject: [PATCH 04/37] wip --- src/protocols/http.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/protocols/http.js b/src/protocols/http.js index df3ac05f2..9679315b9 100644 --- a/src/protocols/http.js +++ b/src/protocols/http.js @@ -182,11 +182,11 @@ class HttpWrapper extends KuzzleAbstractProtocol { return; } - // if (options.verbOverride) { - // route.verb = options.verbOverride; - // } + if (options.verbOverride) { + route.verb = options.verbOverride; + } const - method = 'GET',//route.verb, + method = route.verb, regex = /\/:([^/]*)/; let From b93c0f1cb5ecc1e0922a37f363a8b367165a3861 Mon Sep 17 00:00:00 2001 From: Yoann Abbes Date: Fri, 15 Nov 2019 14:10:29 +0100 Subject: [PATCH 05/37] wip --- src/protocols/http.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/protocols/http.js b/src/protocols/http.js index 9679315b9..9143d5721 100644 --- a/src/protocols/http.js +++ b/src/protocols/http.js @@ -182,11 +182,11 @@ class HttpWrapper extends KuzzleAbstractProtocol { return; } - if (options.verbOverride) { - route.verb = options.verbOverride; + if (options.verb) { + route.verb = options.verb; } const - method = route.verb, + method = 'GET',//route.verb, regex = /\/:([^/]*)/; let @@ -342,7 +342,7 @@ function getCorrectRoute (routes) { } if (sameLength) { - // with same URL size, we keep the POST route + // with same URL size, we keep the GET route return getRoute; } From 35be0080a5ef7e9e60d3c327f0dc0c813712f0a3 Mon Sep 17 00:00:00 2001 From: Yoann Abbes Date: Fri, 15 Nov 2019 14:15:37 +0100 Subject: [PATCH 06/37] wip --- src/controllers/document.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/controllers/document.js b/src/controllers/document.js index 6fa829d02..63fa1277a 100644 --- a/src/controllers/document.js +++ b/src/controllers/document.js @@ -151,11 +151,12 @@ class DocumentController extends BaseController { .then(response => response.result); } - mGet (index, collection, ids, options = {}) { + mGet (index, collection, _ids, options = {}) { const request = { index, collection, - body: {ids}, + _ids, + //body: {ids}, action: 'mGet', includeTrash: options.includeTrash }; From e0d5b4f23213488a960ea1817c5330baf1d1e00c Mon Sep 17 00:00:00 2001 From: Yoann Abbes Date: Fri, 15 Nov 2019 14:41:36 +0100 Subject: [PATCH 07/37] wip --- src/controllers/document.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/controllers/document.js b/src/controllers/document.js index 63fa1277a..f50769f59 100644 --- a/src/controllers/document.js +++ b/src/controllers/document.js @@ -151,7 +151,8 @@ class DocumentController extends BaseController { .then(response => response.result); } - mGet (index, collection, _ids, options = {}) { + mGet (index, collection, ids, options = {}) { + const _ids = ids.toString(); const request = { index, collection, @@ -162,6 +163,9 @@ class DocumentController extends BaseController { }; delete options.includeTrash; + if (options.verb === 'POST') { + request.body = {ids}; + } return this.query(request, options) .then(response => response.result); } From b9b80eedc44fd2ffd273aeb852c1a072822117f9 Mon Sep 17 00:00:00 2001 From: Yoann Abbes Date: Fri, 15 Nov 2019 14:55:36 +0100 Subject: [PATCH 08/37] wip --- src/controllers/document.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/controllers/document.js b/src/controllers/document.js index f50769f59..f14bdac1e 100644 --- a/src/controllers/document.js +++ b/src/controllers/document.js @@ -152,12 +152,9 @@ class DocumentController extends BaseController { } mGet (index, collection, ids, options = {}) { - const _ids = ids.toString(); const request = { index, collection, - _ids, - //body: {ids}, action: 'mGet', includeTrash: options.includeTrash }; @@ -165,6 +162,8 @@ class DocumentController extends BaseController { if (options.verb === 'POST') { request.body = {ids}; + } else { + request._ids = ids.toString(); } return this.query(request, options) .then(response => response.result); From e9e94abce290dcb5da033fea812057295afd94bf Mon Sep 17 00:00:00 2001 From: Yoann Abbes Date: Fri, 15 Nov 2019 14:59:50 +0100 Subject: [PATCH 09/37] [ci skip] wip --- src/protocols/http.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/protocols/http.js b/src/protocols/http.js index 9143d5721..74530810a 100644 --- a/src/protocols/http.js +++ b/src/protocols/http.js @@ -186,7 +186,7 @@ class HttpWrapper extends KuzzleAbstractProtocol { route.verb = options.verb; } const - method = 'GET',//route.verb, + method = route.verb, regex = /\/:([^/]*)/; let @@ -322,7 +322,7 @@ class HttpWrapper extends KuzzleAbstractProtocol { function getCorrectRoute (routes) { let shortestRoute = routes[0], - getRoute, + postRoute, minLength = routes[0].url.length, sameLength = true; @@ -336,14 +336,14 @@ function getCorrectRoute (routes) { minLength = route.url.length; } - if (route.verb === 'GET') { - getRoute = route; + if (route.verb === 'POST') { + postRoute = route; } } if (sameLength) { // with same URL size, we keep the GET route - return getRoute; + return postRoute; } // with differents URL sizes, we keep the shortest because URL params From c79dd3e43d93272829ebea48f1e175b9836df429 Mon Sep 17 00:00:00 2001 From: Yoann Abbes Date: Fri, 15 Nov 2019 15:09:25 +0100 Subject: [PATCH 10/37] [ci skip] wip --- src/protocols/http.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/protocols/http.js b/src/protocols/http.js index 74530810a..f222bac2a 100644 --- a/src/protocols/http.js +++ b/src/protocols/http.js @@ -181,12 +181,9 @@ class HttpWrapper extends KuzzleAbstractProtocol { return; } - - if (options.verb) { - route.verb = options.verb; - } + const - method = route.verb, + method = options.verb || route.verb, regex = /\/:([^/]*)/; let @@ -336,7 +333,7 @@ function getCorrectRoute (routes) { minLength = route.url.length; } - if (route.verb === 'POST') { + if (route.verb === 'GET') { postRoute = route; } } From cec592efbd2e699e5c9e476010c6166ebd0c7ecd Mon Sep 17 00:00:00 2001 From: Yoann Abbes Date: Fri, 15 Nov 2019 15:16:45 +0100 Subject: [PATCH 11/37] [ci skip] wip --- src/controllers/document.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controllers/document.js b/src/controllers/document.js index f14bdac1e..edc08e039 100644 --- a/src/controllers/document.js +++ b/src/controllers/document.js @@ -163,7 +163,7 @@ class DocumentController extends BaseController { if (options.verb === 'POST') { request.body = {ids}; } else { - request._ids = ids.toString(); + request.ids = ids.toString(); } return this.query(request, options) .then(response => response.result); From 1538d9372a368cc0c5f690c3ca83cf38bca1499a Mon Sep 17 00:00:00 2001 From: Yoann Abbes Date: Fri, 15 Nov 2019 15:35:29 +0100 Subject: [PATCH 12/37] [ci skip] wip --- src/protocols/http.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/protocols/http.js b/src/protocols/http.js index f222bac2a..e2feab535 100644 --- a/src/protocols/http.js +++ b/src/protocols/http.js @@ -319,7 +319,7 @@ class HttpWrapper extends KuzzleAbstractProtocol { function getCorrectRoute (routes) { let shortestRoute = routes[0], - postRoute, + getRoute, minLength = routes[0].url.length, sameLength = true; @@ -334,13 +334,14 @@ function getCorrectRoute (routes) { } if (route.verb === 'GET') { - postRoute = route; + getRoute = route; + return getRoute; } } if (sameLength) { // with same URL size, we keep the GET route - return postRoute; + return getRoute; } // with differents URL sizes, we keep the shortest because URL params From 8c2ae9e160aec9e06b7d550bdf1858c34cc3297e Mon Sep 17 00:00:00 2001 From: Yoann Abbes Date: Fri, 15 Nov 2019 15:43:37 +0100 Subject: [PATCH 13/37] [ci skip] wip --- src/protocols/http.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/protocols/http.js b/src/protocols/http.js index e2feab535..84e04cc0f 100644 --- a/src/protocols/http.js +++ b/src/protocols/http.js @@ -335,7 +335,6 @@ function getCorrectRoute (routes) { if (route.verb === 'GET') { getRoute = route; - return getRoute; } } From c366238a594f5043ad51b9f61eb4a9cf6e2580d0 Mon Sep 17 00:00:00 2001 From: Yoann Abbes Date: Fri, 15 Nov 2019 15:53:44 +0100 Subject: [PATCH 14/37] [ci skip] wip --- src/protocols/http.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/protocols/http.js b/src/protocols/http.js index 84e04cc0f..346a59ac6 100644 --- a/src/protocols/http.js +++ b/src/protocols/http.js @@ -338,14 +338,15 @@ function getCorrectRoute (routes) { } } - if (sameLength) { - // with same URL size, we keep the GET route - return getRoute; - } + + //if (sameLength) { + // with same URL size, we keep the GET route + return getRoute || shortestRoute; + //} // with differents URL sizes, we keep the shortest because URL params // will be in the query string - return shortestRoute; + //return shortestRoute; } module.exports = HttpWrapper; From d27e6baa46ffc53c804969de11240a3358e02b9b Mon Sep 17 00:00:00 2001 From: Yoann Abbes Date: Fri, 15 Nov 2019 16:07:16 +0100 Subject: [PATCH 15/37] [ci skip] wip --- src/protocols/http.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/protocols/http.js b/src/protocols/http.js index 346a59ac6..ea226f032 100644 --- a/src/protocols/http.js +++ b/src/protocols/http.js @@ -338,15 +338,10 @@ function getCorrectRoute (routes) { } } - - //if (sameLength) { // with same URL size, we keep the GET route - return getRoute || shortestRoute; - //} - // with differents URL sizes, we keep the shortest because URL params // will be in the query string - //return shortestRoute; + return sameLength ? getRoute : shortestRoute; } module.exports = HttpWrapper; From 68d1808bc1812737dfe3f6897eb2231b0953eec9 Mon Sep 17 00:00:00 2001 From: Yoann Abbes Date: Fri, 15 Nov 2019 16:56:31 +0100 Subject: [PATCH 16/37] revert change --- src/Kuzzle.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Kuzzle.js b/src/Kuzzle.js index f22ebb874..35ae84f8c 100644 --- a/src/Kuzzle.js +++ b/src/Kuzzle.js @@ -407,7 +407,7 @@ class Kuzzle extends KuzzleEventEmitter { } // we follow the api but allow some more logical "mistakes" (the only allowed value for refresh arg is "wait_for") - if (request.refresh || options.refresh) { + if (request.refresh) { request.refresh = 'wait_for'; } From 18fe72983ec2e09839b800893f458fab1779cbe5 Mon Sep 17 00:00:00 2001 From: Yoann Abbes Date: Fri, 15 Nov 2019 17:13:56 +0100 Subject: [PATCH 17/37] fix tests --- src/Kuzzle.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Kuzzle.js b/src/Kuzzle.js index 35ae84f8c..2dcff962e 100644 --- a/src/Kuzzle.js +++ b/src/Kuzzle.js @@ -407,7 +407,10 @@ class Kuzzle extends KuzzleEventEmitter { } // we follow the api but allow some more logical "mistakes" (the only allowed value for refresh arg is "wait_for") - if (request.refresh) { + if (request.refresh || options.refresh) { + if (options.refresh) { + delete options.refresh; + } request.refresh = 'wait_for'; } From 71d66a9a29676bce6fc66be4760fc28200a171b1 Mon Sep 17 00:00:00 2001 From: Yoann Abbes Date: Thu, 21 Nov 2019 17:06:42 +0100 Subject: [PATCH 18/37] fix tests --- src/protocols/http.js | 2 +- test/controllers/document.test.js | 38 +++++++++++++++++++++++-------- test/protocol/http.test.js | 15 ++++++++++-- 3 files changed, 43 insertions(+), 12 deletions(-) diff --git a/src/protocols/http.js b/src/protocols/http.js index ea226f032..d8281a6da 100644 --- a/src/protocols/http.js +++ b/src/protocols/http.js @@ -135,7 +135,7 @@ class HttpWrapper extends KuzzleAbstractProtocol { * @param {Object} data * @returns {Promise} */ - send (data, options) { + send (data, options = {}) { const payload = { action: undefined, diff --git a/test/controllers/document.test.js b/test/controllers/document.test.js index 58c3a8abe..16fc78329 100644 --- a/test/controllers/document.test.js +++ b/test/controllers/document.test.js @@ -249,16 +249,16 @@ describe('Document Controller', () => { }); describe('mGet', () => { - it('should call document/mGet query and return a Promise which resolves the list of documents', () => { - const result = { - hits: [ - {_id: 'document1', _version: 1, _source: {foo: 'bar'}}, - {_id: 'document2', _version: 3, _source: {foo: 'baz'}} - ], - total: 2 - }; + const result = { + hits: [ + { _id: 'document1', _version: 1, _source: { foo: 'bar' } }, + { _id: 'document2', _version: 3, _source: { foo: 'baz' } } + ], + total: 2 + }; + it('should call document/mGet POST query and return a Promise which resolves the list of documents', () => { kuzzle.query.resolves({result}); - + options.verb = 'POST'; return kuzzle.document.mGet('index', 'collection', ['document1', 'document2'], options) .then(res => { should(kuzzle.query) @@ -268,12 +268,32 @@ describe('Document Controller', () => { action: 'mGet', index: 'index', collection: 'collection', + includeTrash: undefined, body: {ids: ['document1', 'document2']} }, options); should(res).be.equal(result); }); }); + it('should call document/mGet GET query and return a Promise which resolves the list of documents', () => { + kuzzle.query.resolves({ result }); + options.verb = undefined; + return kuzzle.document.mGet('index', 'collection', ['document1', 'document2'], options) + .then(res => { + should(kuzzle.query) + .be.calledOnce() + .be.calledWith({ + controller: 'document', + action: 'mGet', + index: 'index', + collection: 'collection', + includeTrash: undefined, + ids: 'document1,document2' + }, options); + + should(res).be.equal(result); + }); + }); }); describe('mReplace', () => { diff --git a/test/protocol/http.test.js b/test/protocol/http.test.js index a47eaa1ad..7d7f74b65 100644 --- a/test/protocol/http.test.js +++ b/test/protocol/http.test.js @@ -690,6 +690,12 @@ describe('HTTP networking module', () => { { verb: 'POST', url: '/:index/:collection/:_id/_create' } ] }, + mGet: { + http: [ + { verb: 'GET', url: '/:index/:collection/_mGet' }, + { verb: 'POST', url: '/:index/:collection/_mGet' } + ] + }, subscribe: {}, list: { http: [ { verb: 'GET', url: '/:index/_list' } ] @@ -703,9 +709,14 @@ describe('HTTP networking module', () => { should(routes.foo.list.url).be.eql('/:index/_list'); should(routes.foo.list.verb).be.eql('GET'); - // with same URL size, we keep the POST route + // with same URL size, we keep the GET route should(routes.foo.login.url).be.eql('/_login/:strategy'); - should(routes.foo.login.verb).be.eql('POST'); + should(routes.foo.login.verb).be.eql('GET'); + + // with same URL size, we keep the GET route + should(routes.foo.mGet.url).be.eql('/:index/:collection/_mGet'); + should(routes.foo.mGet.verb).be.eql('GET'); + // with differents URL sizes, we keep the shortest because URL params // will be in the query string From 6e642164aecba6496a2c87cec79e536b1a31af78 Mon Sep 17 00:00:00 2001 From: Yoann Abbes Date: Thu, 21 Nov 2019 18:56:08 +0100 Subject: [PATCH 19/37] doc --- doc/7/controllers/document/m-get/index.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/7/controllers/document/m-get/index.md b/doc/7/controllers/document/m-get/index.md index 872ba2280..edbf78192 100644 --- a/doc/7/controllers/document/m-get/index.md +++ b/doc/7/controllers/document/m-get/index.md @@ -15,6 +15,11 @@ Gets multiple documents. mGet(index, collection, ids, [options]); ``` +The route exists in `GET` and `POST`. +By default, the SDK hits the `GET` one. +You can force it to be `POST` in the `options`. + + | Argument | Type | Description | | ------------ | --------------- | --------------- | | `index` |
string
| Index name | @@ -29,6 +34,7 @@ Additional query options | Options | Type
(default) | Description | | ---------- | ---------------------- | ---------------------------------------------------------------------------- | | `queuable` |
boolean

(`true`) | If true, queues the request during downtime, until connected to Kuzzle again | +| `verb` |
string
| Forces the verb of the route | ## Resolves From 6114798ac58aa73849019936ddf09a5a73ef71b2 Mon Sep 17 00:00:00 2001 From: Yoann Abbes Date: Fri, 22 Nov 2019 14:03:18 +0100 Subject: [PATCH 20/37] @Aschen requested changes --- src/controllers/document.js | 8 ++++---- test/controllers/document.test.js | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/controllers/document.js b/src/controllers/document.js index cd62d541b..c1dbb3b17 100644 --- a/src/controllers/document.js +++ b/src/controllers/document.js @@ -136,14 +136,14 @@ class DocumentController extends BaseController { const request = { index, collection, - action: 'mGet', - includeTrash: options.includeTrash + action: 'mGet' }; if (options.verb === 'POST') { request.body = {ids}; - } else { - request.ids = ids.toString(); + } + else { + request.ids = ids.join(); } return this.query(request, options) .then(response => response.result); diff --git a/test/controllers/document.test.js b/test/controllers/document.test.js index 16fc78329..4c6b66bc0 100644 --- a/test/controllers/document.test.js +++ b/test/controllers/document.test.js @@ -268,7 +268,6 @@ describe('Document Controller', () => { action: 'mGet', index: 'index', collection: 'collection', - includeTrash: undefined, body: {ids: ['document1', 'document2']} }, options); @@ -287,7 +286,6 @@ describe('Document Controller', () => { action: 'mGet', index: 'index', collection: 'collection', - includeTrash: undefined, ids: 'document1,document2' }, options); From 036a87fc083a7f7ff58987a396608d26bc886b44 Mon Sep 17 00:00:00 2001 From: Yoann Abbes Date: Thu, 9 Jan 2020 14:40:19 +0100 Subject: [PATCH 21/37] add mgetUsers --- src/controllers/security/index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/controllers/security/index.js b/src/controllers/security/index.js index ec3de7759..4db48b772 100644 --- a/src/controllers/security/index.js +++ b/src/controllers/security/index.js @@ -287,6 +287,22 @@ class SecurityController extends BaseController { .then(response => response.result.hits.map(hit => new Profile(this.kuzzle, hit._id , hit._source.policies))); } + mGetUsers(ids, options = {}) { + const request = { + action: 'mGetUsers' + }; + + if (options.verb === 'POST') { + request.body = { ids }; + } + else { + request.ids = ids.join(); + } + + return this.query(request, options) + .then(response => response.result.hits.map(hit => new User(this.kuzzle, hit._id, hit._source.policies))); + } + mGetRoles (ids, options = {}) { return this.query({ action: 'mGetRoles', From 2f06b02293ec9864b51b9559934aa924c465fc62 Mon Sep 17 00:00:00 2001 From: Yoann Abbes Date: Thu, 9 Jan 2020 15:06:08 +0100 Subject: [PATCH 22/37] doc --- .../controllers/security/m-get-users/index.md | 41 +++++++++++++++++++ .../m-get-users/snippets/m-get-users.js | 22 ++++++++++ .../m-get-users/snippets/m-get-users.test.yml | 23 +++++++++++ 3 files changed, 86 insertions(+) create mode 100644 doc/7/controllers/security/m-get-users/index.md create mode 100644 doc/7/controllers/security/m-get-users/snippets/m-get-users.js create mode 100644 doc/7/controllers/security/m-get-users/snippets/m-get-users.test.yml diff --git a/doc/7/controllers/security/m-get-users/index.md b/doc/7/controllers/security/m-get-users/index.md new file mode 100644 index 000000000..941979cc6 --- /dev/null +++ b/doc/7/controllers/security/m-get-users/index.md @@ -0,0 +1,41 @@ +--- +code: true +type: page +title: mGetUsers +description: Gets multiple security users +--- + +# mGetUsers + +Gets multiple security users. + +
+ +```js +mGetUsers(ids, [options]); +``` +The route exists in `GET` and `POST`. +By default, the SDK hits the `GET` one. +You can force it to be `POST` in the `options`. + +
+ +| Property | Type | Description | +|--- |--- |--- | +| `ids` |
array<string>
| User identifiers | +| `options` |
object
| Query options | + +### options + +| Property | Type
(default) | Description | +| --- | --- | --- | +| `queuable` |
boolean

(`true`) | If true, queues the request during downtime, until connected to Kuzzle again | +| `verb` |
string
| Forces the verb of the route | + +## Resolves + +An array of retrieved [`User`](/sdk/js/6/core-classes/user/introduction) objects. + +## Usage + +<<< ./snippets/m-get-users.js \ No newline at end of file diff --git a/doc/7/controllers/security/m-get-users/snippets/m-get-users.js b/doc/7/controllers/security/m-get-users/snippets/m-get-users.js new file mode 100644 index 000000000..3df52f0e0 --- /dev/null +++ b/doc/7/controllers/security/m-get-users/snippets/m-get-users.js @@ -0,0 +1,22 @@ +try { + const response = await kuzzle.security.mGetUsers([ + 'user1', + 'user2', + 'user3' + ]); + + console.log(response); + /* + [ User { + _id: 'user1', + profileIds: ['profile1'], + User { + _id: 'user2', + profileIds: ['profile2'], + User { + _id: 'user3', + profileIds: ['profile3'] ] + */ +} catch (e) { + console.error(e); +} diff --git a/doc/7/controllers/security/m-get-users/snippets/m-get-users.test.yml b/doc/7/controllers/security/m-get-users/snippets/m-get-users.test.yml new file mode 100644 index 000000000..205c09dd8 --- /dev/null +++ b/doc/7/controllers/security/m-get-users/snippets/m-get-users.test.yml @@ -0,0 +1,23 @@ +name: security#mGetUsers +description: mget users +hooks: + before: | + for i in 1 2 3; do + curl -H "Content-type: application/json" -d ' + "content": { + "profileIds": ["profile${i}"], + "fullname": "user${i}" + }, + "credentials" { + "local": { + "username": "foo", + "password": "bar" + } + }, kuzzle:7512/users/user${i}/_create ' + done + after: | + for i in 1 2 3; do + curl -XDELETE kuzzle:7512/users/user${i} + done +template: default +expected: '^ _id: ''user3'',$' From 448b5283482bd33a1f82866241f538beed322171 Mon Sep 17 00:00:00 2001 From: Yoann Abbes Date: Thu, 9 Jan 2020 15:21:34 +0100 Subject: [PATCH 23/37] fix --- src/controllers/security/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controllers/security/index.js b/src/controllers/security/index.js index 4db48b772..ed800aa25 100644 --- a/src/controllers/security/index.js +++ b/src/controllers/security/index.js @@ -300,7 +300,7 @@ class SecurityController extends BaseController { } return this.query(request, options) - .then(response => response.result.hits.map(hit => new User(this.kuzzle, hit._id, hit._source.policies))); + .then(response => response.result.hits.map(hit => new User(this.kuzzle, hit._id, hit._source))); } mGetRoles (ids, options = {}) { From 28196381cc37f2c337430524ea2af061269f563c Mon Sep 17 00:00:00 2001 From: Yoann-Abbes <44844010+Yoann-Abbes@users.noreply.github.com> Date: Thu, 9 Jan 2020 17:02:21 +0100 Subject: [PATCH 24/37] Update doc/7/controllers/security/m-get-users/index.md Co-Authored-By: Adrien Maret --- doc/7/controllers/security/m-get-users/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/7/controllers/security/m-get-users/index.md b/doc/7/controllers/security/m-get-users/index.md index 941979cc6..27a43336d 100644 --- a/doc/7/controllers/security/m-get-users/index.md +++ b/doc/7/controllers/security/m-get-users/index.md @@ -12,7 +12,7 @@ Gets multiple security users.
```js -mGetUsers(ids, [options]); +mGetUsers(kuids, [options]); ``` The route exists in `GET` and `POST`. By default, the SDK hits the `GET` one. @@ -38,4 +38,4 @@ An array of retrieved [`User`](/sdk/js/6/core-classes/user/introduction) objects ## Usage -<<< ./snippets/m-get-users.js \ No newline at end of file +<<< ./snippets/m-get-users.js From 9c70403e319d89a74460f51281ec8b8cf6a6002f Mon Sep 17 00:00:00 2001 From: Yoann-Abbes <44844010+Yoann-Abbes@users.noreply.github.com> Date: Thu, 9 Jan 2020 17:02:28 +0100 Subject: [PATCH 25/37] Update doc/7/controllers/security/m-get-users/index.md Co-Authored-By: Adrien Maret --- doc/7/controllers/security/m-get-users/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/7/controllers/security/m-get-users/index.md b/doc/7/controllers/security/m-get-users/index.md index 27a43336d..5f2ff60d8 100644 --- a/doc/7/controllers/security/m-get-users/index.md +++ b/doc/7/controllers/security/m-get-users/index.md @@ -34,7 +34,7 @@ You can force it to be `POST` in the `options`. ## Resolves -An array of retrieved [`User`](/sdk/js/6/core-classes/user/introduction) objects. +An array of retrieved [`User`](/sdk/js/7/core-classes/user/introduction) objects. ## Usage From d242e9ebeadde1857273c426f5cd90f7b0dd015c Mon Sep 17 00:00:00 2001 From: Yoann Abbes Date: Wed, 5 Feb 2020 09:30:56 +0100 Subject: [PATCH 26/37] hook snippet doc --- .../security/m-get-users/snippets/m-get-users.test.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/7/controllers/security/m-get-users/snippets/m-get-users.test.yml b/doc/7/controllers/security/m-get-users/snippets/m-get-users.test.yml index 205c09dd8..5ac0bee68 100644 --- a/doc/7/controllers/security/m-get-users/snippets/m-get-users.test.yml +++ b/doc/7/controllers/security/m-get-users/snippets/m-get-users.test.yml @@ -3,7 +3,7 @@ description: mget users hooks: before: | for i in 1 2 3; do - curl -H "Content-type: application/json" -d ' + curl -H "Content-type: application/json" -d '{ "content": { "profileIds": ["profile${i}"], "fullname": "user${i}" @@ -13,7 +13,8 @@ hooks: "username": "foo", "password": "bar" } - }, kuzzle:7512/users/user${i}/_create ' + } + }' kuzzle:7512/users/user${i}/_create done after: | for i in 1 2 3; do From cbd2eac2691c80b6112c4a73bbf7ed747c5886b6 Mon Sep 17 00:00:00 2001 From: Yoann Abbes Date: Wed, 5 Feb 2020 10:21:41 +0100 Subject: [PATCH 27/37] hook snippet doc --- .../security/m-get-users/snippets/m-get-users.test.yml | 8 ++++---- src/controllers/security/index.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/7/controllers/security/m-get-users/snippets/m-get-users.test.yml b/doc/7/controllers/security/m-get-users/snippets/m-get-users.test.yml index 5ac0bee68..b482c7fc0 100644 --- a/doc/7/controllers/security/m-get-users/snippets/m-get-users.test.yml +++ b/doc/7/controllers/security/m-get-users/snippets/m-get-users.test.yml @@ -5,12 +5,12 @@ hooks: for i in 1 2 3; do curl -H "Content-type: application/json" -d '{ "content": { - "profileIds": ["profile${i}"], - "fullname": "user${i}" + "profileIds": ["default"], + "fullname": "user'${i}'" }, - "credentials" { + "credentials": { "local": { - "username": "foo", + "username": "user'${i}'", "password": "bar" } } diff --git a/src/controllers/security/index.js b/src/controllers/security/index.js index 0626b7972..fdf038160 100644 --- a/src/controllers/security/index.js +++ b/src/controllers/security/index.js @@ -355,7 +355,7 @@ class SecurityController extends BaseController { .then(response => response.result.hits.map(hit => new Profile(this.kuzzle, hit._id , hit._source.policies))); } - mGetUsers(ids, options = {}) { + mGetUsers (ids, options = {}) { const request = { action: 'mGetUsers' }; From 6aba5d44acff000217a827728d2cd7cc44c5bd31 Mon Sep 17 00:00:00 2001 From: Yoann Abbes Date: Wed, 5 Feb 2020 10:36:46 +0100 Subject: [PATCH 28/37] getAllStats snipper hook --- .../server/get-all-stats/snippets/get-all-stats.test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/7/controllers/server/get-all-stats/snippets/get-all-stats.test.yml b/doc/7/controllers/server/get-all-stats/snippets/get-all-stats.test.yml index 9f3e4c6bf..86c6a81d6 100644 --- a/doc/7/controllers/server/get-all-stats/snippets/get-all-stats.test.yml +++ b/doc/7/controllers/server/get-all-stats/snippets/get-all-stats.test.yml @@ -4,7 +4,7 @@ hooks: before: after: template: default -expected: ^(All Kuzzle Stats:) {"hits":\[({"connections":{.*},"ongoingRequests":{.*},"completedRequests":{}.*},"failedRequests":{.*},"timestamp":[0-9]{13}}(,)*)+\],"total":[0-9]+}$ +expected: ^(All Kuzzle Stats:) {"hits":\[({"completedRequests":{.*}, "connections":{.*},"failedRequests":{.*},"ongoingRequests":{.*},"timestamp":[0-9]{13}}(,)*)+\],"total":[0-9]+}$ sdk: js version: 6 From 22ab7a5dce99c5f5ebb88d8c5a2e99c298887112 Mon Sep 17 00:00:00 2001 From: Yoann Abbes Date: Wed, 5 Feb 2020 13:29:42 +0100 Subject: [PATCH 29/37] adapt doc snippets getAllStats and getLastStats --- .../server/get-all-stats/snippets/get-all-stats.test.yml | 2 +- .../server/get-last-stats/snippets/get-last-stats.test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/7/controllers/server/get-all-stats/snippets/get-all-stats.test.yml b/doc/7/controllers/server/get-all-stats/snippets/get-all-stats.test.yml index 86c6a81d6..192d2f475 100644 --- a/doc/7/controllers/server/get-all-stats/snippets/get-all-stats.test.yml +++ b/doc/7/controllers/server/get-all-stats/snippets/get-all-stats.test.yml @@ -4,7 +4,7 @@ hooks: before: after: template: default -expected: ^(All Kuzzle Stats:) {"hits":\[({"completedRequests":{.*}, "connections":{.*},"failedRequests":{.*},"ongoingRequests":{.*},"timestamp":[0-9]{13}}(,)*)+\],"total":[0-9]+}$ +expected: ^(All Kuzzle Stats:) {"hits":\[({"completedRequests":{.*},"connections":{.*},"failedRequests":{.*},"ongoingRequests":{.*},"timestamp":[0-9]{13}}(,)*)+\],"total":[0-9]+}$ sdk: js version: 6 diff --git a/doc/7/controllers/server/get-last-stats/snippets/get-last-stats.test.yml b/doc/7/controllers/server/get-last-stats/snippets/get-last-stats.test.yml index 0e9b5b000..1fa420d09 100644 --- a/doc/7/controllers/server/get-last-stats/snippets/get-last-stats.test.yml +++ b/doc/7/controllers/server/get-last-stats/snippets/get-last-stats.test.yml @@ -4,7 +4,7 @@ hooks: before: after: template: default -expected: ^(Last Kuzzle Stats:) {("connections":{.*}),("ongoingRequests":{.*}),("completedRequests":{.*}),("failedRequests":{.*}),("timestamp":[0-9]{13})}$ +expected: ^(Last Kuzzle Stats:) {("timestamp":[0-9]{13}),("completedRequests":{.*}),("connections":{.*}),("failedRequests":{.*}),("ongoingRequests":{.*})}$ sdk: js version: 6 From f1238dc0c093fbcc2ad9b60cb73aa2884c744cb2 Mon Sep 17 00:00:00 2001 From: Yoann Abbes Date: Fri, 7 Feb 2020 11:40:32 +0100 Subject: [PATCH 30/37] test --- src/controllers/auth.js | 2 +- src/controllers/document.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/controllers/auth.js b/src/controllers/auth.js index 028a4d729..95fe82b42 100644 --- a/src/controllers/auth.js +++ b/src/controllers/auth.js @@ -247,7 +247,7 @@ class AuthController extends BaseController { action: 'login' }; - return this.query(request, {queuable: false}) + return this.query(request, {queuable: false, verb: 'POST'}) .then(response => { try { this._authenticationToken = new Jwt(response.result.jwt); diff --git a/src/controllers/document.js b/src/controllers/document.js index 1ac3f9623..807571881 100644 --- a/src/controllers/document.js +++ b/src/controllers/document.js @@ -194,6 +194,7 @@ class DocumentController extends BaseController { action: 'search', }; + options.verb = 'POST'; for (const opt of ['from', 'size', 'scroll']) { request[opt] = options[opt]; delete options[opt]; From 20d686cb2979c67fb14c84e544b45731c65529d1 Mon Sep 17 00:00:00 2001 From: Yoann Abbes Date: Fri, 7 Feb 2020 15:22:04 +0100 Subject: [PATCH 31/37] fix document search GET behavior --- src/controllers/document.js | 11 ++++++++--- test/controllers/auth.test.js | 2 +- test/controllers/document.test.js | 4 ++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/controllers/document.js b/src/controllers/document.js index 807571881..35c92df20 100644 --- a/src/controllers/document.js +++ b/src/controllers/document.js @@ -190,11 +190,16 @@ class DocumentController extends BaseController { const request = { index, collection, - body, action: 'search', }; - options.verb = 'POST'; + if (options.verb === 'POST') { + request.body = body; + } + else { + request.searchBody = body; + } + for (const opt of ['from', 'size', 'scroll']) { request[opt] = options[opt]; delete options[opt]; @@ -204,7 +209,7 @@ class DocumentController extends BaseController { request.size = 10; } - if (!request.scroll && !request.body.sort && !request.from) { + if (!request.scroll && ((!request.body || !request.body.sort) && (!request.searchBody || !request.searchBody.sort)) && !request.from) { request.from = 0; } diff --git a/test/controllers/auth.test.js b/test/controllers/auth.test.js index 2f5c2eced..bf6901764 100644 --- a/test/controllers/auth.test.js +++ b/test/controllers/auth.test.js @@ -302,7 +302,7 @@ describe('Auth Controller', () => { strategy: 'strategy', expiresIn: 'expiresIn', body: credentials - }, {queuable: false}); + }, {queuable: false, verb: 'POST'}); should(res).be.equal(jwt); }); diff --git a/test/controllers/document.test.js b/test/controllers/document.test.js index 700379415..ae9fc509a 100644 --- a/test/controllers/document.test.js +++ b/test/controllers/document.test.js @@ -402,7 +402,7 @@ describe('Document Controller', () => { action: 'search', index: 'index', collection: 'collection', - body: {foo: 'bar'}, + searchBody: {foo: 'bar'}, from: 0, size: 10, scroll: undefined @@ -436,7 +436,7 @@ describe('Document Controller', () => { action: 'search', index: 'index', collection: 'collection', - body: {foo: 'bar'}, + searchBody: {foo: 'bar'}, from: 1, size: 2, scroll: '1m' From 391c5c1145f7b8eb629b2cef45307a01db99a79e Mon Sep 17 00:00:00 2001 From: Yoann Abbes Date: Fri, 7 Feb 2020 15:34:38 +0100 Subject: [PATCH 32/37] revert --- src/controllers/document.js | 8 +------- test/controllers/document.test.js | 4 ++-- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/controllers/document.js b/src/controllers/document.js index 35c92df20..ff8d492a3 100644 --- a/src/controllers/document.js +++ b/src/controllers/document.js @@ -190,16 +190,10 @@ class DocumentController extends BaseController { const request = { index, collection, + body, action: 'search', }; - if (options.verb === 'POST') { - request.body = body; - } - else { - request.searchBody = body; - } - for (const opt of ['from', 'size', 'scroll']) { request[opt] = options[opt]; delete options[opt]; diff --git a/test/controllers/document.test.js b/test/controllers/document.test.js index ae9fc509a..700379415 100644 --- a/test/controllers/document.test.js +++ b/test/controllers/document.test.js @@ -402,7 +402,7 @@ describe('Document Controller', () => { action: 'search', index: 'index', collection: 'collection', - searchBody: {foo: 'bar'}, + body: {foo: 'bar'}, from: 0, size: 10, scroll: undefined @@ -436,7 +436,7 @@ describe('Document Controller', () => { action: 'search', index: 'index', collection: 'collection', - searchBody: {foo: 'bar'}, + body: {foo: 'bar'}, from: 1, size: 2, scroll: '1m' From 7f5c5efee6463794513282567613b3b4c7926d64 Mon Sep 17 00:00:00 2001 From: Yoann-Abbes <44844010+Yoann-Abbes@users.noreply.github.com> Date: Thu, 13 Feb 2020 10:59:11 +0100 Subject: [PATCH 33/37] Update doc/7/controllers/security/m-get-users/index.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Sébastien Cottinet --- doc/7/controllers/security/m-get-users/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/7/controllers/security/m-get-users/index.md b/doc/7/controllers/security/m-get-users/index.md index 5f2ff60d8..b43f096da 100644 --- a/doc/7/controllers/security/m-get-users/index.md +++ b/doc/7/controllers/security/m-get-users/index.md @@ -30,7 +30,7 @@ You can force it to be `POST` in the `options`. | Property | Type
(default) | Description | | --- | --- | --- | | `queuable` |
boolean

(`true`) | If true, queues the request during downtime, until connected to Kuzzle again | -| `verb` |
string
| Forces the verb of the route | +| `verb` |
string
| (HTTP only) Forces the verb of the API route | ## Resolves From 08fdc811d17bb9b0d6eeeca3c9746c206eed1e90 Mon Sep 17 00:00:00 2001 From: Yoann-Abbes <44844010+Yoann-Abbes@users.noreply.github.com> Date: Thu, 13 Feb 2020 10:59:29 +0100 Subject: [PATCH 34/37] Update doc/7/controllers/security/m-get-users/index.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Sébastien Cottinet --- doc/7/controllers/security/m-get-users/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/7/controllers/security/m-get-users/index.md b/doc/7/controllers/security/m-get-users/index.md index b43f096da..569965bca 100644 --- a/doc/7/controllers/security/m-get-users/index.md +++ b/doc/7/controllers/security/m-get-users/index.md @@ -22,7 +22,7 @@ You can force it to be `POST` in the `options`. | Property | Type | Description | |--- |--- |--- | -| `ids` |
array<string>
| User identifiers | +| `ids` |
string[]
| User identifiers | | `options` |
object
| Query options | ### options From c84e46cb61bd446d95afd79420a773962bec88be Mon Sep 17 00:00:00 2001 From: Yoann Date: Thu, 13 Feb 2020 11:04:52 +0100 Subject: [PATCH 35/37] @scottinet requested changes --- doc/7/controllers/security/m-get-users/index.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/doc/7/controllers/security/m-get-users/index.md b/doc/7/controllers/security/m-get-users/index.md index 569965bca..6a64c2989 100644 --- a/doc/7/controllers/security/m-get-users/index.md +++ b/doc/7/controllers/security/m-get-users/index.md @@ -14,9 +14,6 @@ Gets multiple security users. ```js mGetUsers(kuids, [options]); ``` -The route exists in `GET` and `POST`. -By default, the SDK hits the `GET` one. -You can force it to be `POST` in the `options`.
@@ -27,10 +24,15 @@ You can force it to be `POST` in the `options`. ### options -| Property | Type
(default) | Description | +| Property | Type | Description | | --- | --- | --- | -| `queuable` |
boolean

(`true`) | If true, queues the request during downtime, until connected to Kuzzle again | -| `verb` |
string
| (HTTP only) Forces the verb of the API route | +| `queuable` |
boolean
| If true, queues the request during downtime, until connected to Kuzzle again | +| `verb` |
string
| (HTTP only) Forces the verb of the API route | + +#### verb + +When instantiated with a HTTP protocol object, the SDK uses the GET API by default for this API route. +You can set the `verb` option to `POST` to force the SDK to use the POST API instead. ## Resolves From e6c8f011e8ecc9633a8d9bf929de0df786cf4445 Mon Sep 17 00:00:00 2001 From: Yoann Date: Thu, 13 Feb 2020 11:34:02 +0100 Subject: [PATCH 36/37] revert search chabges --- src/controllers/document.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controllers/document.js b/src/controllers/document.js index ff8d492a3..1ac3f9623 100644 --- a/src/controllers/document.js +++ b/src/controllers/document.js @@ -203,7 +203,7 @@ class DocumentController extends BaseController { request.size = 10; } - if (!request.scroll && ((!request.body || !request.body.sort) && (!request.searchBody || !request.searchBody.sort)) && !request.from) { + if (!request.scroll && !request.body.sort && !request.from) { request.from = 0; } From ada96e4b535efe8a9229cd0f60b6e0bd8b553d74 Mon Sep 17 00:00:00 2001 From: Yoann Date: Thu, 13 Feb 2020 14:52:42 +0100 Subject: [PATCH 37/37] doc --- doc/7/controllers/document/m-get/index.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/doc/7/controllers/document/m-get/index.md b/doc/7/controllers/document/m-get/index.md index edbf78192..eb5331830 100644 --- a/doc/7/controllers/document/m-get/index.md +++ b/doc/7/controllers/document/m-get/index.md @@ -15,10 +15,6 @@ Gets multiple documents. mGet(index, collection, ids, [options]); ``` -The route exists in `GET` and `POST`. -By default, the SDK hits the `GET` one. -You can force it to be `POST` in the `options`. - | Argument | Type | Description | | ------------ | --------------- | --------------- | @@ -34,7 +30,12 @@ Additional query options | Options | Type
(default) | Description | | ---------- | ---------------------- | ---------------------------------------------------------------------------- | | `queuable` |
boolean

(`true`) | If true, queues the request during downtime, until connected to Kuzzle again | -| `verb` |
string
| Forces the verb of the route | +| `verb` |
string
| (HTTP only) Forces the verb of the route | + +#### verb + +When instantiated with a HTTP protocol object, the SDK uses the GET API by default for this API route. +You can set the `verb` option to `POST` to force the SDK to use the POST API instead. ## Resolves