mirror of
https://github.com/pds-nest/nest.git
synced 2024-11-25 06:24:19 +00:00
inserita verifica per json vuoti o assenti
This commit is contained in:
parent
6c3c0fade8
commit
02886a65db
1 changed files with 6 additions and 0 deletions
|
@ -158,6 +158,9 @@ def page_alert(aid):
|
|||
if alert.repository not in user.owner_of:
|
||||
return json_error("You are not authorized to proceed.", REPOSITORY_NOT_OWNER), 403
|
||||
if request.method == "PATCH":
|
||||
if request.json is None:
|
||||
return json_error("Missing json content.", GENERIC_NO_JSON), 400
|
||||
|
||||
if 'name' in request.json:
|
||||
alert.name = request.json['name']
|
||||
if 'limit' in request.json:
|
||||
|
@ -188,6 +191,9 @@ def page_alert(aid):
|
|||
return json_error("Something went wrong while deleting alert.", ALERT_DELETION_FAILURE), 500
|
||||
return json_success("Deletion completed."), 204
|
||||
elif request.method == "PUT":
|
||||
if request.json is None:
|
||||
return json_error("Missing json content.", GENERIC_NO_JSON), 400
|
||||
|
||||
if not json_request_authorizer(request.json, alert):
|
||||
return json_error("Missing one or more parameters in alert json.", GENERIC_MISSING_FIELDS), 400
|
||||
alert.limit = request.json['limit']
|
||||
|
|
Loading…
Reference in a new issue