[Answer]-Django POST data dictionary is empty when posting from test client

1👍

After trying different combinations of parameter formating, content types, etc..
I found one solution that works :

response = self.client.post(reverse('theurl'), data, 
             **{'HTTP_X_REQUESTED_WITH': 'XMLHttpRequest'})

And I get the following dictionary on the POST parameters of the request:

<QueryDict: {u'name': [u'name']}>

Edit I love testing 🙂

Leave a comment