diff options
author | 2021-06-04 06:44:01 +0300 | |
---|---|---|
committer | 2021-06-04 06:44:32 +0300 | |
commit | f949747aadca05f746530f261fefabeac3e98230 (patch) | |
tree | 2308d2848714f00e4eef5f8a312149544fa5d2ea /backend | |
parent | Reverts "Validates Form Patch Request" (diff) |
Handles Null Webhooks
The form model specifies webhook as nullable, but the validator code
does not properly handle them. This PR adds logic to handle that
scenario.
Signed-off-by: Hassan Abouelela <[email protected]>
Diffstat (limited to 'backend')
-rw-r--r-- | backend/routes/forms/index.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/backend/routes/forms/index.py b/backend/routes/forms/index.py index 5fd90ab..22171fa 100644 --- a/backend/routes/forms/index.py +++ b/backend/routes/forms/index.py @@ -51,12 +51,14 @@ class FormsList(Route): # Verify Webhook try: # Get url from request - url = form_data[WebHook.__name__.lower()][WebHook.URL.value] + webhook = form_data[WebHook.__name__.lower()] + if webhook is not None: + url = webhook[WebHook.URL.value] - # Validate URL - validation = await validate_hook_url(url) - if validation: - return JSONResponse(validation.errors(), status_code=422) + # Validate URL + validation = await validate_hook_url(url) + if validation: + return JSONResponse(validation.errors(), status_code=422) except KeyError: pass |