Skip to content

Commit

Permalink
make user/password nullable; fix user/password string check
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Schretlen committed Feb 5, 2020
1 parent c4d5c87 commit a8f5f5a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions x-pack/plugins/actions/server/builtin_action_types/webhook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { i18n } from '@kbn/i18n';
import { curry } from 'lodash';
import { curry, isString } from 'lodash';
import axios, { AxiosError, AxiosResponse } from 'axios';
import { schema, TypeOf } from '@kbn/config-schema';
import { pipe } from 'fp-ts/lib/pipeable';
Expand Down Expand Up @@ -36,8 +36,8 @@ type ActionTypeConfigType = TypeOf<typeof ConfigSchema>;
// secrets definition
export type ActionTypeSecretsType = TypeOf<typeof SecretsSchema>;
const secretSchemaProps = {
user: schema.maybe(schema.string()),
password: schema.maybe(schema.string()),
user: schema.nullable(schema.string()),
password: schema.nullable(schema.string()),
};
const SecretsSchema = schema.object(secretSchemaProps, {
validate: secrets => {
Expand Down Expand Up @@ -107,7 +107,7 @@ export async function executor(

const secrets: ActionTypeSecretsType = execOptions.secrets as ActionTypeSecretsType;
const basicAuth =
secrets.user && secrets.password
isString(secrets.user) && isString(secrets.password)
? { auth: { username: secrets.user, password: secrets.password } }
: {};

Expand Down

0 comments on commit a8f5f5a

Please sign in to comment.