mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
refactor(core): Extract load-options context out of NodeExecutionFunctions (no-changelog) (#11461)
This commit is contained in:
committed by
GitHub
parent
a092b8e972
commit
da18e1ad29
@@ -74,38 +74,23 @@ export class WebhookContext extends NodeExecutionContext implements IWebhookFunc
|
||||
}
|
||||
|
||||
getBodyData() {
|
||||
if (this.additionalData.httpRequest === undefined) {
|
||||
throw new ApplicationError('Request is missing');
|
||||
}
|
||||
return this.additionalData.httpRequest.body as IDataObject;
|
||||
return this.assertHttpRequest().body as IDataObject;
|
||||
}
|
||||
|
||||
getHeaderData() {
|
||||
if (this.additionalData.httpRequest === undefined) {
|
||||
throw new ApplicationError('Request is missing');
|
||||
}
|
||||
return this.additionalData.httpRequest.headers;
|
||||
return this.assertHttpRequest().headers;
|
||||
}
|
||||
|
||||
getParamsData(): object {
|
||||
if (this.additionalData.httpRequest === undefined) {
|
||||
throw new ApplicationError('Request is missing');
|
||||
}
|
||||
return this.additionalData.httpRequest.params;
|
||||
return this.assertHttpRequest().params;
|
||||
}
|
||||
|
||||
getQueryData(): object {
|
||||
if (this.additionalData.httpRequest === undefined) {
|
||||
throw new ApplicationError('Request is missing');
|
||||
}
|
||||
return this.additionalData.httpRequest.query;
|
||||
return this.assertHttpRequest().query;
|
||||
}
|
||||
|
||||
getRequestObject(): Request {
|
||||
if (this.additionalData.httpRequest === undefined) {
|
||||
throw new ApplicationError('Request is missing');
|
||||
}
|
||||
return this.additionalData.httpRequest;
|
||||
return this.assertHttpRequest();
|
||||
}
|
||||
|
||||
getResponseObject(): Response {
|
||||
@@ -115,6 +100,14 @@ export class WebhookContext extends NodeExecutionContext implements IWebhookFunc
|
||||
return this.additionalData.httpResponse;
|
||||
}
|
||||
|
||||
private assertHttpRequest() {
|
||||
const { httpRequest } = this.additionalData;
|
||||
if (httpRequest === undefined) {
|
||||
throw new ApplicationError('Request is missing');
|
||||
}
|
||||
return httpRequest;
|
||||
}
|
||||
|
||||
getNodeWebhookUrl(name: string): string | undefined {
|
||||
return getNodeWebhookUrl(
|
||||
name,
|
||||
|
||||
Reference in New Issue
Block a user