Skip to content

Commit 04ed4a2

Browse files
committed
Adding test file for 4704856
I apparently forgot to commit this long ago. It's been sitting on my computer.
1 parent 1823171 commit 04ed4a2

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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

0 commit comments

Comments
 (0)