Scrapy, a fast high-level web crawling & scraping framework for Python.
[HttpCompressionMiddleware] fix delimiter for Accept-Encoding header
Evgeny Dorofeev4e56571a196c
diff --git a/scrapy/downloadermiddlewares/httpcompression.py b/scrapy/downloadermiddlewares/httpcompression.pyindex 65b652953..0010b2a8f 100644--- a/scrapy/downloadermiddlewares/httpcompression.py+++ b/scrapy/downloadermiddlewares/httpcompression.py@@ -26,7 +26,7 @@ class HttpCompressionMiddleware(object):def process_request(self, request, spider):request.headers.setdefault('Accept-Encoding',- b",".join(ACCEPTED_ENCODINGS))+ b", ".join(ACCEPTED_ENCODINGS))def process_response(self, request, response, spider):diff --git a/tests/test_downloadermiddleware_httpcompression.py b/tests/test_downloadermiddleware_httpcompression.pyindex c6a823b53..64488841a 100644--- a/tests/test_downloadermiddleware_httpcompression.py+++ b/tests/test_downloadermiddleware_httpcompression.py@@ -48,7 +48,7 @@ class HttpCompressionTest(TestCase):}response = Response('http://scrapytest.org/', body=body, headers=headers)- response.request = Request('http://scrapytest.org', headers={'Accept-Encoding': 'gzip,deflate'})+ response.request = Request('http://scrapytest.org', headers={'Accept-Encoding': 'gzip, deflate'})return responsedef test_process_request(self):@@ -56,7 +56,7 @@ class HttpCompressionTest(TestCase):assert 'Accept-Encoding' not in request.headersself.mw.process_request(request, self.spider)self.assertEqual(request.headers.get('Accept-Encoding'),- b','.join(ACCEPTED_ENCODINGS))+ b', '.join(ACCEPTED_ENCODINGS))def test_process_response_gzip(self):response = self._getresponse('gzip')