[英]How to add custom HTTP response header in Flask-RESTful?
我正在使用Flask-RESTful,并想通过在响应中添加自定义HTTP标头来处理某些错误。 有标准的Flask或Flask-RESTful方法吗?
原来我跳过了文档的那一部分:
class Todo3(Resource):
def get(self):
# Set the response code to 201 and return custom headers
return {'task': 'Hello world'}, 201, {'Etag': 'some-opaque-string'}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.