From b3a8ad362d7793b7b5428f69827cacd8eb6e24f0 Mon Sep 17 00:00:00 2001 From: Jari Kolehmainen Date: Wed, 4 Jan 2023 12:30:40 +0200 Subject: [PATCH] don't override getRequestOptions if they are set Signed-off-by: Jari Kolehmainen --- .../k8s-api/create-json-api.injectable.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/common/k8s-api/create-json-api.injectable.ts b/src/common/k8s-api/create-json-api.injectable.ts index d847c39ee4..f1e998334c 100644 --- a/src/common/k8s-api/create-json-api.injectable.ts +++ b/src/common/k8s-api/create-json-api.injectable.ts @@ -23,15 +23,17 @@ const createJsonApiInjectable = getInjectable({ const lensProxyCert = di.inject(lensProxyCertificateInjectionToken); return (config, reqInit) => { - config.getRequestOptions = async () => { - const agent = new Agent({ - ca: lensProxyCert.get().cert, - }); - - return { - agent, + if (!config.getRequestOptions) { + config.getRequestOptions = async () => { + const agent = new Agent({ + ca: lensProxyCert.get().cert, + }); + + return { + agent, + }; }; - }; + } return new JsonApi(deps, config, reqInit); };