如何在对OPTIONS请求的响应中添加“Accept-Patch”标头?

时间:2015-03-02 20:07:40

标签: http flask httpresponse http-method http-options-method

我正在使用Flask。我很遗憾如何为我的服务器可能获得的任何OPTIONS请求添加“Accept-Patch”响应。

会不会是这样的(我试过这个,虽然它有效但我不确定是否允许这样做):

class MyViewMixin(MethodView):
    def options(self, id):
        response = make_response('This works!', 200)
        response.headers.extend({'Accept-Patch': '*'})
        return response

    def get(self, id): #same for post, delete, put, patch
        #stuff here#

感谢您的帮助。

0 个答案:

没有答案