I'm using the python requests module to do some testing against a site.
The requests module allows you to remove certain headers by passing in a dictionary with the keys set to None. For example
headers = {u'User-Agent': None}
will ensure that no user agent is sent with the request.
However, it seems that when I post data, requests will calculate the correct Content-Length for me even if I specify None, or an incorrect value. Eg.
headers = {u'Content-Length': u'999'}
headers = {u'Content-Length': None}
I check the response for the headers used in the request (response.request.headers) and I can see the the Content-Length has been re-added with the correct value. So Far I cannot see any way to disable this behaviour
CaseInsensitiveDict({'Content-Length': '39', 'Content-Type': 'application/x-www-form-urlencoded', 'Accept-Encoding': 'gzip, deflate, compress', 'Accept': '*/*', 'User-Agent': 'python-requests/2.2.1 CPython/2.7.6 Linux/3.13.0-36-generic'})
I'd REALLY like to remain with the requests module to do this. Is this possible?