From bf11ab2b212de5bfee143d6e53584434d85b32a7 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Sat, 13 Feb 2010 12:32:01 +0000 Subject: [1.1.X] Fixed #12011 -- Modified the test client to preserve the request scheme on a redirect. Thanks to tgardner for the report and patch. Backport of r12419 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12421 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/test/client.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'django') diff --git a/django/test/client.py b/django/test/client.py index d56472c1ae..60dcfb4309 100644 --- a/django/test/client.py +++ b/django/test/client.py @@ -465,11 +465,15 @@ class Client(object): redirect_chain = response.redirect_chain redirect_chain.append((url, response.status_code)) + extra = {} + if scheme: + extra['wsgi.url_scheme'] = scheme + # The test client doesn't handle external links, # but since the situation is simulated in test_client, # we fake things here by ignoring the netloc portion of the # redirected URL. - response = self.get(path, QueryDict(query), follow=False) + response = self.get(path, QueryDict(query), follow=False, **extra) response.redirect_chain = redirect_chain # Prevent loops -- cgit v1.3