mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-18 05:28:16 -06:00
14008 add webhook_headers to configuration.py
This commit is contained in:
parent
2f211034a9
commit
1f439a4464
@ -284,16 +284,14 @@ class Webhook(CustomFieldsMixin, ExportTemplatesMixin, TagsMixin, ChangeLoggedMo
|
|||||||
"""
|
"""
|
||||||
Render additional_headers and return a dict of Header: Value pairs.
|
Render additional_headers and return a dict of Header: Value pairs.
|
||||||
"""
|
"""
|
||||||
headers = get_config().WEBHOOK_HEADERS.update(self.additional_headers)
|
headers = get_config().WEBHOOK_HEADERS
|
||||||
|
if self.additional_headers:
|
||||||
|
data = render_jinja2(self.additional_headers, context)
|
||||||
|
for line in data.splitlines():
|
||||||
|
header, value = line.split(':', 1)
|
||||||
|
headers[header.strip()] = value.strip()
|
||||||
|
|
||||||
if not headers:
|
return headers
|
||||||
return {}
|
|
||||||
ret = {}
|
|
||||||
data = render_jinja2(headers, context)
|
|
||||||
for line in data.splitlines():
|
|
||||||
header, value = line.split(':', 1)
|
|
||||||
ret[header.strip()] = value.strip()
|
|
||||||
return ret
|
|
||||||
|
|
||||||
def render_body(self, context):
|
def render_body(self, context):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user