Null POST/PUT bodies were causing REST failures
Change-Id: I11725dfd1feb7b080160a361cd9fec65bba4bf78
Issue-ID: SO-356
Signed-off-by: DeWayne Filppi <dewayne@cloudify.co>
diff --git a/aria/aria-rest-server/src/main/python/aria-rest/aria_rest/rest.py b/aria/aria-rest-server/src/main/python/aria-rest/aria_rest/rest.py
index 45fb429..7b9223d 100644
--- a/aria/aria-rest-server/src/main/python/aria-rest/aria_rest/rest.py
+++ b/aria/aria-rest-server/src/main/python/aria-rest/aria_rest/rest.py
@@ -116,7 +116,7 @@
elif rtype == "json":
- body = request.json
+ body = request.json or {}
# Check body
if "service_template_path" in body:
@@ -169,7 +169,7 @@
"""
Validates a TOSCA template
"""
- body = request.json
+ body = request.json or {}
# Check body
if "service_template_path" in body:
@@ -385,7 +385,7 @@
"""
Creates a service from the specified service template
"""
- body = request.json
+ body = request.json or {}
inputs = {}
if 'inputs' in body:
inputs = body['inputs']
@@ -542,7 +542,7 @@
"""
Start an execution for the specified service
"""
- body = request.json
+ body = request.json or {}
executor = DryExecutor(
) if 'executor' in body and body['executor'] == 'dry' else None
@@ -585,7 +585,7 @@
"""
Resume the specified execution
"""
- body = request.json
+ body = request.json or {}
execution = model_storage.execution.get(execution_id)
if execution.status != execution.status.CANCELLED:
return "cancelled execution cannot be resumed", 400
@@ -619,7 +619,7 @@
Cancel the specified execution
"""
logger.info("cancelling execution {}".format(execution_id))
- body = request.json
+ body = request.json or {}
try:
execution = model_storage.execution.get(execution_id)