mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 10:31:15 +00:00
✨ OPTIONS request support for Production/Test Webhooks (#787)
* 🐛 Fix naming of events in AffinityTrigger Node * 🚧 OPTIONS allow header response for production webhooks * ✅ Implemented Allow header for test webhook OPTIONS response Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
@@ -161,6 +161,24 @@ export class ActiveWorkflowRunner {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all request methods associated with a single webhook
|
||||
* @param path webhook path
|
||||
*/
|
||||
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);
|
||||
return webhookMethods;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ids of the currently active workflows
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user