fix(Cortex Node): Fix issue that not all Analyzers got returned (#3606)

* Updated Cortex analyzer search url to fetch all

* Updated Cortex credentials

* Nodelinter fixes

* More fixes
This commit is contained in:
Jonathan Bennetts
2022-06-29 07:42:35 +01:00
committed by GitHub
parent 522b31a47b
commit 6e595c7276
4 changed files with 249 additions and 237 deletions

View File

@@ -2,12 +2,6 @@ import {
OptionsWithUri,
} from 'request';
import {
IAnalyzer,
IJob,
IResponder,
} from './AnalyzerInterface';
import {
IExecuteFunctions,
IExecuteSingleFunctions,
@@ -25,10 +19,8 @@ export async function cortexApiRequest(this: IHookFunctions | IExecuteFunctions
const credentials = await this.getCredentials('cortexApi');
const headerWithAuthentication = Object.assign({}, { Authorization: ` Bearer ${credentials.cortexApiKey}` });
let options: OptionsWithUri = {
headers: headerWithAuthentication,
headers: {},
method,
qs: query,
uri: uri || `${credentials.host}/api${resource}`,
@@ -47,7 +39,7 @@ export async function cortexApiRequest(this: IHookFunctions | IExecuteFunctions
}
try {
return await this.helpers.request!(options);
return await this.helpers.requestWithAuthentication.call(this, 'cortexApi', options);
} catch (error) {
throw new NodeApiError(this.getNode(), error);
}