2024-04-26 00:58:18 发布
网友
我知道我们可以使用HttpResponseInstance['headername'] = 'headervalue'向http响应添加头。但是通过这种方式,我必须重写我正在使用的所有通用视图,这会使工作更加复杂。在
HttpResponseInstance['headername'] = 'headervalue'
有没有一种方便的方法可以向响应添加头,比如响应的回调或url装饰器?在
你应该使用一个中间件类。Check out this thread.
django1.10及更高版本__init__和{}应该实现。process_response已弃用。在
__init__
process_response
您可以编写一个middleware类并实现方法^{}。在
你应该使用一个中间件类。Check out this thread.
django1.10及更高版本}应该实现。
__init__
和{process_response
已弃用。在您可以编写一个middleware类并实现方法^{} 。在
相关问题 更多 >
编程相关推荐