Retrieve node version

This commit is contained in:
Iván Ovejero 2022-04-28 14:10:55 +02:00
parent 402480e54d
commit 1ff95c354d

View file

@ -883,15 +883,13 @@ export class HttpRequest implements INodeType {
]; ];
let authenticateWith; let authenticateWith;
let isHttpRequestNodeVersion1 = false; const nodeVersion = this.getNode().typeVersion;
const responseFormat = this.getNodeParameter('responseFormat', 0) as string; const responseFormat = this.getNodeParameter('responseFormat', 0) as string;
try { try {
authenticateWith = this.getNodeParameter('authenticateWith', 0) as 'nodeCredential' | 'genericAuth' | 'none'; authenticateWith = this.getNodeParameter('authenticateWith', 0) as 'nodeCredential' | 'genericAuth' | 'none';
} catch (_) { } catch (_) {}
isHttpRequestNodeVersion1 = true;
}
let httpBasicAuth; let httpBasicAuth;
let httpDigestAuth; let httpDigestAuth;
@ -901,7 +899,7 @@ export class HttpRequest implements INodeType {
let oAuth2Api; let oAuth2Api;
let nodeCredentialType; let nodeCredentialType;
if (authenticateWith === 'genericAuth' || isHttpRequestNodeVersion1) { if (authenticateWith === 'genericAuth' || nodeVersion === 1) {
try { try {
httpBasicAuth = await this.getCredentials('httpBasicAuth'); httpBasicAuth = await this.getCredentials('httpBasicAuth');
} catch (_) {} } catch (_) {}
@ -1219,7 +1217,7 @@ export class HttpRequest implements INodeType {
if ( if (
authenticateWith === 'genericAuth' || authenticateWith === 'genericAuth' ||
authenticateWith === 'none' || authenticateWith === 'none' ||
isHttpRequestNodeVersion1 nodeVersion === 1
) { ) {
if (oAuth1Api) { if (oAuth1Api) {
requestPromises.push( requestPromises.push(