Opened 15 years ago

Closed 15 years ago

#11786 closed (duplicate)

TestClient() forgets any PUT querystrings if there is payload data

Reported by: steve@… Owned by: nobody
Component: Testing framework Version: 1.1
Severity: Keywords: PUT
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hi

On line 370 of contrib.test.client.py there is the following line in the put() method:

'QUERY_STRING': urlencode(data, doseq=True) or parsed[4],

(by comparison, post() has:

'QUERY_STRING': parsed[4],

As a a result of the way the code is in put(), if there is a querystring (eg user_token=foo123) and also payload data with the PUT { foo:'12' } , the querystring is overwritten with the payload data.

Now, I'm not 100% whether PUT can take querystrings and payload data at the same time, but if it is supposed to, how about instead we have line 370 as:

'QUERY_STRING': parsed[4] or urlencode(data, doseq=True),

Which seems to work fine (ie, my app's tests now pass)

Change History (1)

comment:1 by Karen Tracey, 15 years ago

Resolution: duplicate
Status: newclosed

#11371 looks like the same issue.

Note: See TracTickets for help on using tickets.
Back to Top