Issue adding request headers for Django Tests
<p>I need to add a header to a request in a Django test. I have browsed a few pages on both Stack Overflow and elsewhere, following various suggestions. I can add the headers to PUTs and GETs successfully, but having an issue with POSTs. Any advice would be greatly appreciated.</p>

<p>For PUT and GET I have used the following [passing successfully]:</p>

<pre><code>resp = self.client.put(resource_url, res_params, **{'HTTP_SSL_CLIENT_CERT': self.client_cert})
</code></pre>

<p>For POST, I tried the same thing but am receiving the error: 
"'str' object has no attribute 'items'"</p>

<p>I have tried the following:</p>

<pre><code>resp = self.client.post(resource_url, res_params, **{'HTTP_SSL_CLIENT_CERT': self.client_cert})

resp = self.client.post(resource_url, res_params, HTTP_SSL_CLIENT_CERT=self.client_cert)

resp = self.client.post(resource_url, res_params, HTTP_SSL_CLIENT_CERT='1234567890')
</code></pre>

<p>For anybody that finds themselves looking at this page with a similar issue, I was able to get this working with the following:</p>

<pre><code>resp = self.client.post(resource_url, data=res_params, content_type='application/json', HTTP_SSL_CLIENT_CERT=self.client_cert)
</code></pre>

python django django-testing