Do not decode of head response

This commit is contained in:
omer 2016-05-23 19:52:38 +03:00 committed by Paul Tremberth
parent a04dbca22d
commit a9c73601ca
1 changed files with 10 additions and 0 deletions

View File

@ -144,3 +144,13 @@ class HttpCompressionTest(TestCase):
self.assertIs(newresponse, response)
self.assertEqual(response.headers['Content-Encoding'], b'gzip')
self.assertEqual(response.headers['Content-Type'], b'application/gzip')
def test_process_response_head_request_no_decode_required(self):
response = self._getresponse('gzip')
response.headers['Content-Type'] = 'application/gzip'
request = response.request
request.method = 'HEAD'
response = response.replace(body = None)
newresponse = self.mw.process_response(request, response, self.spider)
self.assertIs(newresponse, response)
self.assertEquals(response.body, '')