From 02fe545967daf578e3ecb8c954f029842c70e727 Mon Sep 17 00:00:00 2001 From: Jan Oberhauser Date: Thu, 27 Oct 2022 14:40:14 +0200 Subject: [PATCH] fix(HTTP Request Node): Fix sending previously selected credentials also on V2 (#4457) --- .../HttpRequest/V2/HttpRequestV2.node.ts | 45 +++++++++++-------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/packages/nodes-base/nodes/HttpRequest/V2/HttpRequestV2.node.ts b/packages/nodes-base/nodes/HttpRequest/V2/HttpRequestV2.node.ts index ad954e361..db136e16a 100644 --- a/packages/nodes-base/nodes/HttpRequest/V2/HttpRequestV2.node.ts +++ b/packages/nodes-base/nodes/HttpRequest/V2/HttpRequestV2.node.ts @@ -627,24 +627,33 @@ export class HttpRequestV2 implements INodeType { let nodeCredentialType; if (authentication === 'genericCredentialType') { - try { - httpBasicAuth = await this.getCredentials('httpBasicAuth'); - } catch (_) {} - try { - httpDigestAuth = await this.getCredentials('httpDigestAuth'); - } catch (_) {} - try { - httpHeaderAuth = await this.getCredentials('httpHeaderAuth'); - } catch (_) {} - try { - httpQueryAuth = await this.getCredentials('httpQueryAuth'); - } catch (_) {} - try { - oAuth1Api = await this.getCredentials('oAuth1Api'); - } catch (_) {} - try { - oAuth2Api = await this.getCredentials('oAuth2Api'); - } catch (_) {} + const genericAuthType = this.getNodeParameter('genericAuthType', 0) as string; + + if (genericAuthType === 'httpBasicAuth') { + try { + httpBasicAuth = await this.getCredentials('httpBasicAuth'); + } catch (_) {} + } else if (genericAuthType === 'httpDigestAuth') { + try { + httpDigestAuth = await this.getCredentials('httpDigestAuth'); + } catch (_) {} + } else if (genericAuthType === 'httpHeaderAuth') { + try { + httpHeaderAuth = await this.getCredentials('httpHeaderAuth'); + } catch (_) {} + } else if (genericAuthType === 'httpQueryAuth') { + try { + httpQueryAuth = await this.getCredentials('httpQueryAuth'); + } catch (_) {} + } else if (genericAuthType === 'oAuth1Api') { + try { + oAuth1Api = await this.getCredentials('oAuth1Api'); + } catch (_) {} + } else if (genericAuthType === 'oAuth2Api') { + try { + oAuth2Api = await this.getCredentials('oAuth2Api'); + } catch (_) {} + } } else if (authentication === 'predefinedCredentialType') { try { nodeCredentialType = this.getNodeParameter('nodeCredentialType', 0) as string;