From 51b1883cb8c06937ae76368f68033f0595b3102c Mon Sep 17 00:00:00 2001 From: Eli Perelman Date: Mon, 6 May 2019 12:42:08 -0500 Subject: [PATCH] Fix DELETE method handler, remove unnecessary promise wrapper --- src/core/public/http/http_service.ts | 2 +- .../public/autocomplete_providers/__tests__/value.js | 1 - .../rollup/public/search/rollup_search_strategy.js | 12 +++++------- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/core/public/http/http_service.ts b/src/core/public/http/http_service.ts index d00e71ecaab4c5b..5a73ade939365df 100644 --- a/src/core/public/http/http_service.ts +++ b/src/core/public/http/http_service.ts @@ -41,7 +41,7 @@ export class HttpService { return { fetch, - delete: shorthand('HEAD'), + delete: shorthand('DELETE'), get: shorthand('GET'), head: shorthand('HEAD'), options: shorthand('OPTIONS'), diff --git a/x-pack/plugins/kuery_autocomplete/public/autocomplete_providers/__tests__/value.js b/x-pack/plugins/kuery_autocomplete/public/autocomplete_providers/__tests__/value.js index d82558dad3bd92a..d2cce4fe59282fd 100644 --- a/x-pack/plugins/kuery_autocomplete/public/autocomplete_providers/__tests__/value.js +++ b/x-pack/plugins/kuery_autocomplete/public/autocomplete_providers/__tests__/value.js @@ -77,7 +77,6 @@ describe('Kuery value suggestions', function () { method: 'POST', body: '{"query":"","field":"machine.os.raw","boolFilter":[]}', credentials: 'same-origin', - signal: {}, headers: { 'Content-Type': 'application/json', 'kbn-version': '1.2.3', diff --git a/x-pack/plugins/rollup/public/search/rollup_search_strategy.js b/x-pack/plugins/rollup/public/search/rollup_search_strategy.js index 3ae5e21a9b065bc..abc0bc620b81a1d 100644 --- a/x-pack/plugins/rollup/public/search/rollup_search_strategy.js +++ b/x-pack/plugins/rollup/public/search/rollup_search_strategy.js @@ -104,10 +104,9 @@ export const rollupSearchStrategy = { }); return { - searching: new Promise((resolve, reject) => { - promise.then(result => { - resolve(shimHitsInFetchResponse(result)); - }).catch(error => { + searching: promise + .then(shimHitsInFetchResponse) + .catch(error => { const { body: { statusText, error: title, message }, res: { url }, @@ -122,9 +121,8 @@ export const rollupSearchStrategy = { type: getSearchErrorType({ message }), }); - reject(searchError); - }); - }), + return Promise.reject(searchError); + }), abort: () => controller.abort(), failedSearchRequests, };