mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 10:31:15 +00:00
⚡ Small improvements to OPTIONS request for webhooks
This commit is contained in:
@@ -161,21 +161,18 @@ export class ActiveWorkflowRunner {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all request methods associated with a single webhook
|
||||
* @param path webhook path
|
||||
*/
|
||||
/**
|
||||
* Gets all request methods associated with a single webhook
|
||||
*
|
||||
* @param {string} path webhook path
|
||||
* @returns {Promise<string[]>}
|
||||
* @memberof ActiveWorkflowRunner
|
||||
*/
|
||||
async getWebhookMethods(path: string) : Promise<string[]> {
|
||||
const webhooks = await Db.collections.Webhook?.find({ webhookPath: path}) as IWebhookDb[];
|
||||
|
||||
// check if something exist
|
||||
if (webhooks === undefined) {
|
||||
// The requested webhooks are not registered
|
||||
throw new ResponseHelper.ResponseError(`The requested webhook "${path}" is not registered.`, 404, 404);
|
||||
}
|
||||
|
||||
// Gather all request methods in string array
|
||||
let webhookMethods : string[] = webhooks.map(webhook => webhook.method);
|
||||
const webhookMethods: string[] = webhooks.map(webhook => webhook.method);
|
||||
return webhookMethods;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user