From 0a4606fe0bcd35086e2bd87fa615efd1e8b31323 Mon Sep 17 00:00:00 2001 From: phantom Date: Thu, 11 Jul 2024 14:47:33 +0200 Subject: [PATCH] #202: Handle case with stateful notify and no body --- apprise_api/api/views.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apprise_api/api/views.py b/apprise_api/api/views.py index 9c0e68d..bda4e4b 100644 --- a/apprise_api/api/views.py +++ b/apprise_api/api/views.py @@ -764,7 +764,7 @@ def post(self, request, key): 'error': msg, }, encoder=JSONEncoder, safe=False, status=status) - if not content: + if not content and not body_not_required: # We could not handle the Content-Type logger.warning( 'NOTIFY - %s - Invalid FORM Payload provided using KEY: %s', @@ -1236,6 +1236,9 @@ def post(self, request): # rules rules = {k[1:]: v for k, v in request.GET.items() if k[0] == ':'} + body_not_required = request.GET.get('body_not_required') == 'true' + title_not_required = request.GET.get('title_not_required') == 'true' + # our content content = {} if not json_payload: @@ -1329,9 +1332,6 @@ def post(self, request): if not content.get('title') and 'title' in request.GET: content['title'] = request.GET['title'] - body_not_required = request.GET.get('body_not_required') == 'true' - title_not_required = request.GET.get('title_not_required') == 'true' - # Some basic error checking if (not content.get('body') and not body_not_required) or \ content.get('type', apprise.NotifyType.INFO) \