mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
⚡ Add "Split Into Items" option to HTTP Request node (#1912)
* Added the option to flatten output so we can more easily work with arrays * ⚡ Change parameter name Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
@@ -347,6 +347,20 @@ export class HttpRequest implements INodeType {
|
||||
placeholder: 'http://myproxy:3128',
|
||||
description: 'HTTP proxy to use.',
|
||||
},
|
||||
{
|
||||
displayName: 'Split Into Items',
|
||||
name: 'splitIntoItems',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Outputs each element of an array as own item.',
|
||||
displayOptions: {
|
||||
show: {
|
||||
'/responseFormat': [
|
||||
'json',
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
displayName: 'Timeout',
|
||||
name: 'timeout',
|
||||
@@ -1005,7 +1019,11 @@ export class HttpRequest implements INodeType {
|
||||
}
|
||||
}
|
||||
|
||||
returnItems.push({ json: response });
|
||||
if (options.splitIntoItems === true && Array.isArray(response)) {
|
||||
response.forEach(item => returnItems.push({ json: item }));
|
||||
} else {
|
||||
returnItems.push({ json: response });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user