在某些特定情况下,我希望以如下方式响应错误:
上面的代码返回了一个
而非
text/html
内容类型。class MyResource(Resource):
def get(self):
if some_condition:
return 'bad argument', 400
上面的代码返回了一个
application/json
类型的内容:'"bad argument"'
而非
text/html
类型的内容:'bad argument'
我该如何强制 flask-restful 使用 text/html
类型来响应?