mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 20:24:05 -08:00
Add option to return the headers of the message
This commit is contained in:
parent
8a22cc7114
commit
23b9e7bbe1
|
@ -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;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue