Skip to content

Commit

Permalink
caronc#202: Handle case with stateful notify and no body
Browse files Browse the repository at this point in the history
  • Loading branch information
phantom committed Jul 11, 2024
1 parent d8e05be commit 0a4606f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions apprise_api/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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) \
Expand Down

0 comments on commit 0a4606f

Please sign in to comment.