fix(Fix Rocketchat Node): Fix authentication issue (#3778)

This commit is contained in:
Jonathan Bennetts
2022-07-27 09:46:25 +01:00
committed by GitHub
parent 2e194a6daa
commit 2710061523

View File

@@ -4,10 +4,9 @@ import {
import { import {
IExecuteFunctions, IExecuteFunctions,
IHookFunctions,
ILoadOptionsFunctions, ILoadOptionsFunctions,
} from 'n8n-core'; } from 'n8n-core';
import { NodeApiError, NodeOperationError, } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
export async function rocketchatApiRequest(this: IExecuteFunctions | ILoadOptionsFunctions, resource: string, method: string, operation: string, body: any = {}, headers?: object): Promise<any> { // tslint:disable-line:no-any export async function rocketchatApiRequest(this: IExecuteFunctions | ILoadOptionsFunctions, resource: string, method: string, operation: string, body: any = {}, headers?: object): Promise<any> { // tslint:disable-line:no-any
const credentials = await this.getCredentials('rocketchatApi'); const credentials = await this.getCredentials('rocketchatApi');
@@ -23,7 +22,7 @@ export async function rocketchatApiRequest(this: IExecuteFunctions | ILoadOption
delete options.body; delete options.body;
} }
try { try {
return await this.helpers.request!(options); return await this.helpers.requestWithAuthentication.call(this, 'rocketchatApi', options);
} catch (error) { } catch (error) {
throw new NodeApiError(this.getNode(), error); throw new NodeApiError(this.getNode(), error);
} }