Fix POST and PUT methods of REST API

The json attribute was taken from the wrong object, so we got an error
for every POST or PUT request.
   AttributeError: module 'bottle' has no attribute 'json'

Change-Id: Id32e6b0f227ef0f3bde91feac7269635c051e123
This commit is contained in:
Shachar Snapiri 2018-12-10 17:27:34 +02:00
parent ca688e4290
commit b61ac21d6a
1 changed files with 2 additions and 2 deletions

View File

@ -63,7 +63,7 @@ def get_all(nbapi, model, name):
@nbapi_decorator
def create(nbapi, model, name):
"""POST is create! Create a new instance"""
json_data_dict = bottle.json
json_data_dict = bottle.request.json
if not json_data_dict:
bottle.abort(HTTPStatus.PRECONDITION_FAILED.value,
"JSON content required")
@ -77,7 +77,7 @@ def create(nbapi, model, name):
@nbapi_decorator
def update(nbapi, model, name):
"""PUT is update! Update an existing instance"""
json_data_dict = bottle.json
json_data_dict = bottle.request.json
if not json_data_dict:
bottle.abort(HTTPStatus.PRECONDITION_FAILED.value,
"JSON content required")