Skip to content
Myr

red tests derived from @dhagrow's examples in #760

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Shivaram Lingamneni · committed by Shivaram Lingamneni · parent a94fcb8 · Browse files · 1 file+16 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+16 added−0 removed

  • tests:+16 added−0 removed

1 file+16 added−0 removed

modified:tests/test_requests.py+16 added
977 unmodified lines
978 r = post(httpbin('post'), data=data)979 t = json.loads(r.text)980 self.assertEqual(t.get('headers').get('Content-Type'), '')981982 def test_prefetch_redirect_bug(self):983 """Test that prefetch persists across redirections."""984 res = get(httpbin('redirect/2'), prefetch=False)985 # prefetch should persist across the redirect; if it doesn't,986 # this attempt to iterate will crash because the content has already987 # been read.988 first_line = next(res.iter_lines())989 self.assertTrue(first_line.strip().startswith('{'))990991 def test_prefetch_return_response_interaction(self):992 """Test that prefetch can be overridden as a kwarg to `send`."""993 req = requests.get(httpbin('get'), return_response=False)994 req.send(prefetch=False)995 # content should not have been prefetched, and iter_lines should succeed996 first_line = next(req.response.iter_lines())997 self.assertTrue(first_line.strip().startswith('{'))998999if __name__ == '__main__':1000 unittest.main()