mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
⚡ Improvements to #1356
This commit is contained in:
@@ -24,18 +24,20 @@ import {
|
||||
*
|
||||
*/
|
||||
|
||||
export async function SIGNL4ApiRequest(this: IExecuteFunctions, method: string, contentType: string, body: string, query: IDataObject = {}, teamSecret?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
export async function SIGNL4ApiRequest(this: IExecuteFunctions, method: string, body: string, query: IDataObject = {}, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
const credentials = this.getCredentials('signl4Api');
|
||||
|
||||
const teamSecret = credentials?.teamSecret as string;
|
||||
|
||||
let options: OptionsWithUri = {
|
||||
headers: {
|
||||
'Accept': '*/*',
|
||||
'Content-Type': contentType
|
||||
},
|
||||
method,
|
||||
body,
|
||||
qs: query,
|
||||
uri: "https://connect.signl4.com/webhook/" + teamSecret,
|
||||
json: false,
|
||||
uri: `https://connect.signl4.com/webhook/${teamSecret}`,
|
||||
json: true,
|
||||
};
|
||||
|
||||
if (!Object.keys(body).length) {
|
||||
@@ -46,8 +48,10 @@ export async function SIGNL4ApiRequest(this: IExecuteFunctions, method: string,
|
||||
}
|
||||
options = Object.assign({}, options, option);
|
||||
|
||||
console.log(options);
|
||||
|
||||
try {
|
||||
return JSON.parse(await this.helpers.request!(options));
|
||||
return await this.helpers.request!(options);
|
||||
} catch (error) {
|
||||
|
||||
if (error.response && error.response.body && error.response.body.details) {
|
||||
|
||||
Reference in New Issue
Block a user