title: In Django REST API unittest, how do I send JSON parameters as body in client.get() function?
body: <p>I'm building a REST API with <code>Django</code> and in some places I need to send HTTP GET with many parameters. Because of that I've decided to send them as JSON in the request.body. Now, the app works fine but not the unit testing. I cannot seem to find a way to send the JSON parameters in the body using the self.client.get(). This is what I'm doing:</p>
  
  <pre><code>import json
  from django.test import TestCase
  from django.core.urlresolvers import reverse
  
  class RestApiTests(TestCase):
      def test_analysis():
          extra = {'CONTENT_TYPE': 'application/json'}
          resp = self.client.get(reverse('restapi_analysis'), data="{'analysisID': 41}", **extra)
          self.assertEqual(json.loads(resp.content)['statusText'], 'Analysis fetched successfully')
  </code></pre>
  
  <p>Using this and running the unittests I get the following error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/home/anascu/svn/django-tc-reporting/tcsite/tcapp/tests/test_restapi.py", line 151, in test_analysis
      resp = self.client.get(reverse('restapi_analysis'), data="{'analysisID': 41}", **extra)
    File "/home/anascu/virtenv/tc-tracker/local/lib/python2.7/site-packages/django/test/client.py", line 439, in get
      response = super(Client, self).get(path, data=data, **extra)
    File "/home/anascu/virtenv/tc-tracker/local/lib/python2.7/site-packages/django/test/client.py", line 240, in get
      'QUERY_STRING':    urlencode(data, doseq=True) or parsed[4],
    File "/home/anascu/virtenv/tc-tracker/local/lib/python2.7/site-packages/django/utils/http.py", line 75, in urlencode
  for k, v in query],
  ValueError: need more than 1 value to unpack
  </code></pre>
  
  <p>POST works fine but I need to use GET in this case. Is it even possible? Django version is 1.4.5.</p>