Quick hack to prevent django from adding vary:cookie on proxy view
This commit is contained in:
parent
2083f1d93c
commit
3ca24f5838
2 changed files with 3 additions and 0 deletions
|
@ -68,3 +68,4 @@ class TestsProxy(TestCase):
|
||||||
response = self.client.get(url, params, **headers)
|
response = self.client.get(url, params, **headers)
|
||||||
self.assertEquals(response.status_code, 200)
|
self.assertEquals(response.status_code, 200)
|
||||||
self.assertIn('Example Domain', response.content)
|
self.assertIn('Example Domain', response.content)
|
||||||
|
self.assertNotIn("Cookie", response['Vary'])
|
||||||
|
|
|
@ -229,5 +229,7 @@ class AjaxProxy(View):
|
||||||
status_code = proxied_request.code
|
status_code = proxied_request.code
|
||||||
mimetype = proxied_request.headers.typeheader or mimetypes.guess_type(url)
|
mimetype = proxied_request.headers.typeheader or mimetypes.guess_type(url)
|
||||||
content = proxied_request.read()
|
content = proxied_request.read()
|
||||||
|
# Quick hack to prevent Django from adding a Vary: Cookie header
|
||||||
|
self.request.session.accessed = False
|
||||||
return HttpResponse(content, status=status_code, mimetype=mimetype)
|
return HttpResponse(content, status=status_code, mimetype=mimetype)
|
||||||
ajax_proxy = AjaxProxy.as_view()
|
ajax_proxy = AjaxProxy.as_view()
|
||||||
|
|
Loading…
Reference in a new issue