cleanup REST api
authorstevenvanrossem <steven.vanrossem@intec.ugent.be>
Thu, 14 Jul 2016 20:02:02 +0000 (22:02 +0200)
committerstevenvanrossem <steven.vanrossem@intec.ugent.be>
Thu, 14 Jul 2016 20:02:02 +0000 (22:02 +0200)
src/emuvim/api/rest/compute.py
src/emuvim/api/rest/network.py

index f8da428..e412133 100755 (executable)
@@ -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")
index 68256f5..3c0062e 100755 (executable)
@@ -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")