#31494: Test client discards query string when following 307 or 308 redirects
-------------------------------------+-------------------------------------
Reporter: Max Crowe | Owner: nobody
Type: | Status: new
Uncategorized |
Component: Testing | Version: 3.0
framework | Keywords: test client
Severity: Normal | redirect
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
If an application uses an HTTP 307 or 308 response to redirect /foo/ to
/bar/?a=b, when the test client is instructed to follow redirects, the
ultimate request will be to /bar/ (with no query string). This is due to
the fact that the test client only examines the query portion of the
response URL if the HTTP status is not 307 or 308:
{{{#!python
if response.status_code in (HTTPStatus.TEMPORARY_REDIRECT,
HTTPStatus.PERMANENT_REDIRECT):
# Preserve request method post-redirect for 307/308 responses.
request_method = getattr(self,
response.request['REQUEST_METHOD'].lower())
else:
request_method = self.get
data = QueryDict(url.query)
content_type = None
}}}
The test client should respect query strings indicated in redirect URLs,
even if the request method is something other than GET or HEAD.
--
Ticket URL: <https://code.djangoproject.com/ticket/31494>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/052.d9fad6e4ffa25356d6401c7de86c4da0%40djangoproject.com.