diff --git a/httpbin/core.py b/httpbin/core.py index 44fd322..db56da2 100644 --- a/httpbin/core.py +++ b/httpbin/core.py @@ -426,6 +426,7 @@ def drip(): response = Response(generate_bytes(), headers={ "Content-Type": "application/octet-stream", + "Content-Length": str(numbytes), }) response.status_code = code diff --git a/test_httpbin.py b/test_httpbin.py index d63dbeb..093ce71 100755 --- a/test_httpbin.py +++ b/test_httpbin.py @@ -193,11 +193,13 @@ class HttpbinTestCase(unittest.TestCase): def test_drip(self): response = self.app.get('/drip?numbytes=400&duration=2&delay=1') + self.assertEqual(response.content_length, 400) self.assertEqual(len(response.get_data()), 400) self.assertEqual(response.status_code, 200) def test_drip_with_custom_code(self): response = self.app.get('/drip?numbytes=400&duration=2&code=500') + self.assertEqual(response.content_length, 400) self.assertEqual(len(response.get_data()), 400) self.assertEqual(response.status_code, 500)