mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
feat(HTTP Request Node): Replace HttpRequest Tool with tool version of standalone HttpRequest Node (#14669)
This commit is contained in:
@@ -63,6 +63,8 @@ export class ToolHttpRequest implements INodeType {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
// Replaced by a `usableAsTool` version of the standalone HttpRequest node
|
||||||
|
hidden: true,
|
||||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
||||||
inputs: [],
|
inputs: [],
|
||||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
||||||
|
|||||||
@@ -71,6 +71,15 @@ export class HttpRequestV3 implements INodeType {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
usableAsTool: {
|
||||||
|
replacements: {
|
||||||
|
codex: {
|
||||||
|
subcategories: {
|
||||||
|
Tools: ['Recommended Tools'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
properties: mainProperties,
|
properties: mainProperties,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -151,7 +151,19 @@ const jsonOptimizer = (ctx: IExecuteFunctions, itemIndex: number): ResponseOptim
|
|||||||
|
|
||||||
if (!Array.isArray(responseData)) {
|
if (!Array.isArray(responseData)) {
|
||||||
if (dataField) {
|
if (dataField) {
|
||||||
|
if (!Object.prototype.hasOwnProperty.call(responseData, dataField)) {
|
||||||
|
throw new NodeOperationError(
|
||||||
|
ctx.getNode(),
|
||||||
|
`Target field "${dataField}" not found in response.`,
|
||||||
|
{
|
||||||
|
itemIndex,
|
||||||
|
description: `The response contained these fields: [${Object.keys(responseData).join(', ')}]`,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const data = responseData[dataField] as IDataObject | IDataObject[];
|
const data = responseData[dataField] as IDataObject | IDataObject[];
|
||||||
|
|
||||||
if (Array.isArray(data)) {
|
if (Array.isArray(data)) {
|
||||||
responseData = data;
|
responseData = data;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user