1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Merge branch 'develop' into develop-2.7

This commit is contained in:
Jeremy Stretch
2019-10-17 15:51:33 -04:00
9 changed files with 94 additions and 7 deletions

View File

@@ -67,6 +67,12 @@ class Webhook(models.Model):
default=WEBHOOK_CT_JSON,
verbose_name='HTTP content type'
)
additional_headers = JSONField(
null=True,
blank=True,
help_text="User supplied headers which should be added to the request in addition to the HTTP content type. "
"Headers are supplied as key/value pairs in a JSON object."
)
secret = models.CharField(
max_length=255,
blank=True,
@@ -112,6 +118,12 @@ class Webhook(models.Model):
'ca_file_path': 'Do not specify a CA certificate file if SSL verification is dissabled.'
})
# Verify that JSON data is provided as an object
if self.additional_headers and type(self.additional_headers) is not dict:
raise ValidationError({
'additional_headers': 'Header JSON data must be in object form. Example: {"X-API-KEY": "abc123"}'
})
#
# Custom fields