def require_json(req, resp, resource, params):
if req.method in ('POST', 'PUT', 'PATCH'):
if req.content_type is None or 'application/json' not in req.content_type:
raise falcon.HTTPUnsupportedMediaType(
'This API only supports requests encoded as JSON.',
href='http://docs.examples.com/api/json')
评论列表
文章目录