[英]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.