| | 4 | |
| | 5 | {{{ |
| | 6 | # view |
| | 7 | def index(self, request): |
| | 8 | if request.GET.get('inner_request') == 'true': |
| | 9 | # Within a request/response, perform another request to the same live server. |
| | 10 | # This one get's stuck. |
| | 11 | urllib.urlopen(request.build_absolute_uri()) |
| | 12 | return HttpResponse() |
| | 13 | |
| | 14 | # test |
| | 15 | class LiveServerTests(LiveServerTestCase): |
| | 16 | def test_request_within_request(self): |
| | 17 | response = requests.get(self.live_server_url, params={'inner_request': 'true'}) |
| | 18 | |
| | 19 | # This code is never reached (or the live server throws a timeout) |
| | 20 | self.assertEqual(response.status_code, 200) |
| | 21 | }}} |
| | 22 | |
| | 23 | The use case is somewhat fictional. |