* status: new => closed
* ui_ux: => 0
* resolution: => wontfix
* easy: => 0
Comment:
To be honest, the title of this ticket doesn't make much sense given how
HTTP works. There are two orthogonal mechanisms involved here:
- 1) HTTP methods
- `Client.get` performs a GET request;
- `Client.post` performs a POST request.
- 2) HTML forms
- when submitted with a GET, form data is encoded in the query string,
and Django exposes it in `request.GET`;
- when submitted with a POST, it's in the request body, and Django
exposes it in `request.POST`.
The `data` argument of the test client is designed to hold simulated form
data, and is automatically inserted in requests according to these rules.
----
That said, it's absolutely legal to use query string parameters in the URL
of a POST request. But that isn't be form data. Adding an argument called
`get_data` would be extremely confusing.
In addition, I'm not eager to add a `query_string_parameters` argument to
the test client, because Django favors clean URL design. I'm also afraid
of possible confusions with form data in GET requests.
So, for all these reasons, I'm going to reject this ticket. The
recommended solution is to use `self.client.post('/my/url/?param=value',
form_data)`.
--
Ticket URL: <https://code.djangoproject.com/ticket/14611#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Comment (by Dan Strokirk):
Would it be possible to reopen and reevaluate this ticket? It’s 11 years
later, and I feel this would be a great, simple addition to Django’s
testing toolset.
--
Ticket URL: <https://code.djangoproject.com/ticket/14611#comment:6>
Comment (by Mariusz Felisiak):
Replying to [comment:6 Dan Strokirk]:
> Would it be possible to reopen and reevaluate this ticket? It’s 11 years
later, and I feel this would be a great, simple addition to Django’s
testing toolset.
For now, I don't see a consensus in the [https://forum.djangoproject.com/t
/suggestion-adding-params-to-testclient-http-methods/21246 discussion] and
we need it to reopen the ticket. I'd wait a little longer and get more
opinions.
--
Ticket URL: <https://code.djangoproject.com/ticket/14611#comment:7>
Comment (by Lily Foote):
Replying to [comment:7 Mariusz Felisiak]:
> Replying to [comment:6 Dan Strokirk]:
> > Would it be possible to reopen and reevaluate this ticket? It’s 11
years later, and I feel this would be a great, simple addition to Django’s
testing toolset.
>
> For now, I don't see a consensus in the
[https://forum.djangoproject.com/t/suggestion-adding-params-to-testclient-
http-methods/21246 discussion] and we need it to reopen the ticket. I'd
wait a little longer and get more opinions.
I think we have consensus in the linked thread and should reopen.
--
Ticket URL: <https://code.djangoproject.com/ticket/14611#comment:8>