We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 16d6fea commit 7e2214cCopy full SHA for 7e2214c
httpbin/core.py
@@ -481,7 +481,7 @@ def generate_bytes():
481
chunks = []
482
483
for i in xrange(n):
484
- chunks.append(chr(random.randint(0, 255)))
+ chunks.append(os.urandom(1))
485
if len(chunks) == chunk_size:
486
yield(bytes().join(chunks))
487
test_httpbin.py
@@ -134,6 +134,11 @@ def test_get_bytes(self):
134
self.assertEqual(len(response.get_data()), 1024)
135
self.assertEqual(response.status_code, 200)
136
137
+ def test_stream_bytes(self):
138
+ response = self.app.get('/stream-bytes/1024')
139
+ self.assertEqual(len(response.get_data()), 1024)
140
+ self.assertEqual(response.status_code, 200)
141
+
142
143
if __name__ == '__main__':
144
unittest.main()
0 commit comments