From 898bf79161448a4ea3f1456c571836247990f2df Mon Sep 17 00:00:00 2001 From: Orhan Toy Date: Fri, 15 Oct 2021 15:17:56 +0200 Subject: [PATCH] [App Search] Fix handling of body-less meta engine responses (#115043) The issue is that we're trying to parse the JSON response body when in fact we don't return a response body. --- .../server/routes/app_search/source_engines.test.ts | 2 ++ .../server/routes/app_search/source_engines.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/source_engines.test.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/source_engines.test.ts index 67edcc356e902..4374bbe88e183 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/source_engines.test.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/source_engines.test.ts @@ -92,6 +92,7 @@ describe('source engine routes', () => { it('creates a request to enterprise search', () => { expect(mockRequestHandler.createRequest).toHaveBeenCalledWith({ path: '/as/engines/:name/source_engines/bulk_create', + hasJsonResponse: false, }); }); }); @@ -145,6 +146,7 @@ describe('source engine routes', () => { it('creates a request to enterprise search', () => { expect(mockRequestHandler.createRequest).toHaveBeenCalledWith({ path: '/as/engines/:name/source_engines/:source_engine_name', + hasJsonResponse: false, }); }); }); diff --git a/x-pack/plugins/enterprise_search/server/routes/app_search/source_engines.ts b/x-pack/plugins/enterprise_search/server/routes/app_search/source_engines.ts index 1d41a82287b0e..79be0c9c29322 100644 --- a/x-pack/plugins/enterprise_search/server/routes/app_search/source_engines.ts +++ b/x-pack/plugins/enterprise_search/server/routes/app_search/source_engines.ts @@ -45,6 +45,7 @@ export function registerSourceEnginesRoutes({ }, enterpriseSearchRequestHandler.createRequest({ path: '/as/engines/:name/source_engines/bulk_create', + hasJsonResponse: false, }) ); @@ -60,6 +61,7 @@ export function registerSourceEnginesRoutes({ }, enterpriseSearchRequestHandler.createRequest({ path: '/as/engines/:name/source_engines/:source_engine_name', + hasJsonResponse: false, }) ); }