mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
Add option to return the headers of the message
This commit is contained in:
@@ -122,6 +122,13 @@ export class KafkaTrigger implements INodeType {
|
|||||||
default: 30000,
|
default: 30000,
|
||||||
description: 'The time to await a response in ms.',
|
description: 'The time to await a response in ms.',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Return headers',
|
||||||
|
name: 'returnHeaders',
|
||||||
|
type: 'boolean',
|
||||||
|
default: false,
|
||||||
|
description: 'Return the headers received from Kafka',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -199,6 +206,16 @@ export class KafkaTrigger implements INodeType {
|
|||||||
} catch (error) { }
|
} catch (error) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (options.returnHeaders) {
|
||||||
|
const headers: {[key: string]: string} = {};
|
||||||
|
for (const key in message.headers) {
|
||||||
|
const header = message.headers[key];
|
||||||
|
headers[key] = header?.toString('utf8') || '';
|
||||||
|
}
|
||||||
|
|
||||||
|
data.headers = headers;
|
||||||
|
}
|
||||||
|
|
||||||
data.message = value;
|
data.message = value;
|
||||||
data.topic = topic;
|
data.topic = topic;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user