From 1027edcd4d26047a73bdcad0e3921d8273400df0 Mon Sep 17 00:00:00 2001 From: stevenvanrossem Date: Thu, 14 Jul 2016 22:02:02 +0200 Subject: [PATCH] cleanup REST api --- src/emuvim/api/rest/compute.py | 4 +++- src/emuvim/api/rest/network.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/emuvim/api/rest/compute.py b/src/emuvim/api/rest/compute.py index f8da428..e412133 100755 --- a/src/emuvim/api/rest/compute.py +++ b/src/emuvim/api/rest/compute.py @@ -52,7 +52,9 @@ class ComputeStart(Resource): try: #check if json data is a dict data = request.json - if type(data) is not dict: + if data is None: + data = {} + elif type(data) is not dict: data = json.loads(request.json) network = data.get("network") diff --git a/src/emuvim/api/rest/network.py b/src/emuvim/api/rest/network.py index 68256f5..3c0062e 100755 --- a/src/emuvim/api/rest/network.py +++ b/src/emuvim/api/rest/network.py @@ -74,7 +74,9 @@ class NetworkAction(Resource): try: # check if json data is a dict data = request.json - if type(data) is not dict: + if data is None: + data = {} + elif type(data) is not dict: data = json.loads(request.json) vnf_src_interface = data.get("vnf_src_interface") -- 2.25.1