def get_data(self):
"""
Get request data based on request.method and request.mimetype
Returns:
A regular dict which can be modified(scheme will modify data
on validating)
"""
if request.method in ['GET', 'DELETE']:
return request.args.to_dict()
else:
if request.mimetype == 'application/json':
data = request.get_json()
if not isinstance(data, collections.Mapping):
self.handle_error('JSON content must be object')
return data
else:
return request.form.to_dict()
评论列表
文章目录