'Tests if "Content-Length: 0" is sent for bodyless POST requests.
This is not strictly required by HTTP RFCs but can cause trouble
for some web servers.
See:
https://github.com/scrapy/scrapy/issues/823
https://issues.apache.org/jira/browse/TS-2902
https://github.com/kennethreitz/requests/issues/405
https://bugs.python.org/issue14721'

def test_content_length_zero_bodyless_post_request_headers(self):

    def _test(response):
        self.assertEqual(response.body, '0')
    request = Request(self.getURL('contentlength'), method='POST', headers={'Host': 'example.com'})
    return self.download_request(request, Spider('foo')).addCallback(_test)
