mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed #9351 -- Modified the test client to pass on URL encoded parameters to the underlying views. Thanks to sime for the suggestion.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9398 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
a53ccc8297
commit
95d8c0619a
5 changed files with 113 additions and 16 deletions
|
@ -493,6 +493,18 @@ arguments at time of construction:
|
|||
|
||||
/customers/details/?name=fred&age=7
|
||||
|
||||
.. versionadded:: development
|
||||
|
||||
If you already have the GET arguments in URL-encoded form, you can
|
||||
use that encoding instead of using the data argument. For example,
|
||||
the previous GET request could also be posed as::
|
||||
|
||||
>>> c = Client()
|
||||
>>> c.get('/customers/details/?name=fred&age=7')
|
||||
|
||||
If you provide URL both an encoded GET data and a data argument,
|
||||
the data argument will take precedence.
|
||||
|
||||
.. method:: Client.post(path, data={}, content_type=MULTIPART_CONTENT)
|
||||
|
||||
Makes a POST request on the provided ``path`` and returns a
|
||||
|
@ -544,6 +556,18 @@ arguments at time of construction:
|
|||
Note that you should manually close the file after it has been provided
|
||||
to ``post()``.
|
||||
|
||||
.. versionadded:: development
|
||||
|
||||
If the URL you request with a POST contains encoded parameters, these
|
||||
parameters will be made available in the request.GET data. For example,
|
||||
if you were to make the request::
|
||||
|
||||
>>> c.post('/login/?vistor=true', {'name': 'fred', 'passwd': 'secret'})
|
||||
|
||||
... the view handling this request could interrogate request.POST
|
||||
to retrieve the username and password, and could interrogate request.GET
|
||||
to determine if the user was a visitor.
|
||||
|
||||
.. method:: Client.head(path, data={})
|
||||
|
||||
.. versionadded:: development
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue