From: stevenvanrossem Date: Thu, 14 Jul 2016 20:02:02 +0000 (+0200) Subject: cleanup REST api X-Git-Tag: v3.1~96 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=1027edcd4d26047a73bdcad0e3921d8273400df0;p=osm%2Fvim-emu.git cleanup REST api --- 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")