Skip to content

Commit 842c0d7

Browse files
adamchainztim-schilling
authored andcommitted
Test middleware not injecting when Content-Encoding is set
Follow up to #1560.
1 parent d730db8 commit 842c0d7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/test_integration.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,15 @@ def get_response(request):
9696
# check toolbar insertion before "</body>"
9797
self.assertContains(response, "</div>\n</body>")
9898

99+
def test_middleware_no_injection_when_encoded(self):
100+
def get_response(request):
101+
response = HttpResponse("<html><body></body></html>")
102+
response["Content-Encoding"] = "something"
103+
return response
104+
105+
response = DebugToolbarMiddleware(get_response)(self.request)
106+
self.assertEqual(response.content, b"<html><body></body></html>")
107+
99108
def test_cache_page(self):
100109
# Clear the cache before testing the views. Other tests that use cached_view
101110
# may run earlier and cause fewer cache calls.

0 commit comments

Comments
 (0)