Hi, I'm writing some tests using the Django test client for a REST API. This API uses the PUT method and I'm running into problems with the test client, as it appears to wish to URL encode the data into the query string.
Code is: r = self.client.put('/json/api/endpoint', json.dumps(params), content_type='application/json') and the error is "ValueError: need more than 1 value to unpack" from urlencode() in http.py Since the data is JSON encoded it needs to go a Content-Type: application/json in the body, without any further processing. If the put method is replaced with the post method all works fine - the client leaves the content alone and just puts it into the body. The code paths in test.client.Client.put and test.client.Client.post are different and I don't understand why - the docs (and my understanding of HTTP) is that they should behave exactly the same in terms of entity encoding. Am I missing something, or is this just a bug? Cheers, Malcolm--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.