File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed
x-pack/plugins/security_solution Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -350,7 +350,7 @@ const fleetEnrollAgentForHost = async (
350350
351351 if ( res ) {
352352 const enrollObj : PostAgentEnrollResponse = await res . json ( ) ;
353- if ( ! enrollObj . success ) {
353+ if ( ! res . ok ) {
354354 // eslint-disable-next-line no-console
355355 console . error ( enrollObj ) ;
356356 return ;
@@ -396,7 +396,7 @@ const fleetEnrollAgentForHost = async (
396396 }
397397
398398 const checkinObj : PostAgentCheckinResponse = await checkinRes . json ( ) ;
399- if ( ! checkinObj . success ) {
399+ if ( ! checkinRes . ok ) {
400400 // eslint-disable-next-line no-console
401401 console . error (
402402 `failed to checkin agent [${ enrollObj . item . id } ] for endpoint [${ endpointHost . host . id } ]`
@@ -438,7 +438,7 @@ const fleetEnrollAgentForHost = async (
438438 ) ;
439439
440440 const ackActionObj : PostAgentAcksResponse = await ackActionResp . json ( ) ;
441- if ( ! ackActionObj . success ) {
441+ if ( ! ackActionResp . ok ) {
442442 // eslint-disable-next-line no-console
443443 console . error (
444444 `failed to ACK Actions provided to agent [${ enrollObj . item . id } ] for endpoint [${ endpointHost . host . id } ]`
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import { ResponseError } from '@elastic/elasticsearch/lib/errors';
1010import { KbnClient , ToolingLog } from '@kbn/dev-utils' ;
1111import { AxiosResponse } from 'axios' ;
1212import { KibanaConfig } from '@kbn/dev-utils/target/kbn_client/kbn_client_requester' ;
13- import fetch from 'node-fetch' ;
13+ import fetch , { RequestInit as FetchRequestInit } from 'node-fetch' ;
1414import { indexHostsAndAlerts } from '../../common/endpoint/index_data' ;
1515import { ANCESTRY_LIMIT } from '../../common/endpoint/generate_data' ;
1616import { FLEET_SETUP_API_ROUTES , SETUP_API_ROUTE } from '../../../ingest_manager/common/constants' ;
@@ -29,8 +29,11 @@ class KbnClientWithApiKeySupport extends KbnClient {
2929 // strip auth from url
3030 this . kibanaUrlNoAuth = matches && matches . length === 3 ? matches [ 1 ] + matches [ 3 ] : kibanaUrl ;
3131 }
32- requestWithApiKey ( path : string , init ?: RequestInit | undefined ) {
33- return fetch ( `${ this . kibanaUrlNoAuth } /${ path } ` , init ) ;
32+ requestWithApiKey ( path : string , init ?: RequestInit | undefined ) : Promise < Response > {
33+ return ( fetch (
34+ `${ this . kibanaUrlNoAuth } /${ path } ` ,
35+ init as FetchRequestInit
36+ ) as unknown ) as Promise < Response > ;
3437 }
3538}
3639
You can’t perform that action at this time.
0 commit comments