Skip to content

Commit

Permalink
chore: re-format to minimize unnecessary diff
Browse files Browse the repository at this point in the history
  • Loading branch information
delanni committed Aug 14, 2023
1 parent 604fb34 commit cd70cc5
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,7 @@

import Url from 'url';

import Axios, {
AxiosRequestConfig,
AxiosInstance,
AxiosHeaders,
RawAxiosResponseHeaders,
AxiosResponseHeaders,
} from 'axios';
import Axios, { AxiosRequestConfig, AxiosInstance, AxiosHeaders, AxiosHeaderValue } from 'axios';
import { isAxiosResponseError, isAxiosRequestError } from '@kbn/dev-utils';
import { ToolingLog } from '@kbn/tooling-log';

Expand Down Expand Up @@ -136,7 +130,7 @@ export class GithubApi {
): Promise<{
status: number;
statusText: string;
headers: RawAxiosResponseHeaders | AxiosResponseHeaders;
headers: Record<string, AxiosHeaderValue | undefined>;
data: T;
}> {
const executeRequest = !this.dryRun || options.safeForDryRun;
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/actions/server/lib/axios_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export const request = async <T = unknown>({
return await axios(url, {
...config,
method,
// Axios doesn't support `null` value for `headers` property.
headers,
data: data ?? {},
// use httpAgent and httpsAgent and set axios proxy: false, to be able to handle fail on invalid certs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ const isAxiosError = (error: unknown): error is AxiosError => (error as AxiosErr

export abstract class SubActionConnector<Config, Secrets> {
[k: string]: ((params: unknown) => unknown) | unknown;

private axiosInstance: AxiosInstance;
private subActions: Map<string, SubAction> = new Map();
private configurationUtilities: ActionsConfigurationUtilities;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,7 @@ export const getAxiosOptions = (
switch (provider) {
case OpenAiProviderType.OpenAi:
return {
headers: {
Authorization: `Bearer ${apiKey}`,
['content-type']: 'application/json',
},
headers: { Authorization: `Bearer ${apiKey}`, ['content-type']: 'application/json' },
...responseType,
};
case OpenAiProviderType.AzureAi:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@
* 2.0.
*/

import axios, {
AxiosHeaders,
AxiosInstance,
InternalAxiosRequestConfig,
AxiosResponse,
} from 'axios';
import axios, { AxiosHeaders, AxiosInstance, AxiosResponse } from 'axios';
import { Logger } from '@kbn/core/server';
import { addTimeZoneToDate, getErrorMessage } from '@kbn/actions-plugin/server/lib/axios_utils';
import { ActionsConfigurationUtilities } from '@kbn/actions-plugin/server/actions_config';
Expand Down Expand Up @@ -117,7 +112,7 @@ export const getAxiosInstance = ({
} else {
axiosInstance = axios.create();
axiosInstance.interceptors.request.use(
async (axiosConfig: InternalAxiosRequestConfig) => {
async (axiosConfig) => {
const accessToken = await getOAuthJwtAccessToken({
connectorId,
logger,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ const ParamsSchema = schema.object({
});

export const ActionTypeId = '.torq';

// action type definition
export function getActionType(): TorqActionType {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ export async function executor(
url,
logger,
...basicAuth,
headers: headers!,
headers: headers ? headers : {},
data,
configurationUtilities,
sslOverrides,
Expand Down

0 comments on commit cd70cc5

Please sign in to comment.