File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 1+ from __future__ import absolute_import
2+
3+ from exam import fixture
4+ from django .http import HttpResponse , StreamingHttpResponse
5+
6+ from sentry .testutils import TestCase
7+ from sentry .middleware .proxy import ContentLengthHeaderMiddleware
8+
9+
10+ class ContentLengthHeaderMiddlewareTest (TestCase ):
11+ middleware = fixture (ContentLengthHeaderMiddleware )
12+
13+ def test_simple (self ):
14+ response = self .middleware .process_response (None , HttpResponse ('lol' ))
15+ assert response ['Content-Length' ] == '3'
16+ assert 'Transfer-Encoding' not in response
17+
18+ def test_streaming (self ):
19+ response = self .middleware .process_response (None , StreamingHttpResponse ())
20+ assert response ['Transfer-Encoding' ] == 'chunked'
21+ assert 'Content-Length' not in response
You can’t perform that action at this time.
0 commit comments