forked from platypush/platypush
Make sure that a webhook function never returns a null response
This commit is contained in:
parent
1ea53a6f50
commit
a90aa2cb2e
1 changed files with 5 additions and 1 deletions
|
@ -60,7 +60,7 @@ def hook_route(hook_name):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
send_message(event)
|
send_message(event)
|
||||||
rs = make_response(json.dumps({'status': 'ok', **event_args}))
|
rs = default_rs = make_response(json.dumps({'status': 'ok', **event_args}))
|
||||||
headers = {}
|
headers = {}
|
||||||
status_code = 200
|
status_code = 200
|
||||||
|
|
||||||
|
@ -78,6 +78,10 @@ def hook_route(hook_name):
|
||||||
status_code = rs.get('___code___', status_code)
|
status_code = rs.get('___code___', status_code)
|
||||||
rs = rs['___data___']
|
rs = rs['___data___']
|
||||||
|
|
||||||
|
if rs is None:
|
||||||
|
rs = default_rs
|
||||||
|
headers = {'Content-Type': 'application/json'}
|
||||||
|
|
||||||
rs = make_response(rs)
|
rs = make_response(rs)
|
||||||
else:
|
else:
|
||||||
headers = {'Content-Type': 'application/json'}
|
headers = {'Content-Type': 'application/json'}
|
||||||
|
|
Loading…
Reference in a new issue