Opened 5 years ago

Closed 5 years ago

#19797 closed Bug (duplicate)

Test client does not handle data well

Reported by: FunkyBob Owned by: nobody
Component: Testing framework Version: 1.4
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


When trying to pass an arbitrary request body using self.client.delete(), it does not handle the data the same as using get/post.

result = self.client.delete(...,

data = json.dumps({'key': 'value'}),


Results in:

File ".../lib/python2.7/site-packages/django/test/", line 486, in delete

response = super(Client, self).delete(path, data=data, extra)

File ".../lib/python2.7/site-packages/django/test/", line 313, in delete

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

File ".../local/lib/python2.7/site-packages/django/utils/", line 75, in urlencode

for k, v in query],

ValueError: need more than 1 value to unpack

Whereas the same call using client.get or will pass the data on unmolested when content-type is set the same.

Change History (2)

comment:1 Changed 5 years ago by Aymeric Augustin

I think I fixed that a few months ago.

Can you try with 1.5rc1 or master?

comment:2 Changed 5 years ago by Aymeric Augustin

Resolution: duplicate
Status: newclosed

Closing as a duplicate of #17371. Please reopen if you encounter the problem in master.

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