Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

core: add application/xhtml+xml support to responsetypes

Daniel Grana67ab30a5ba74
diff --git a/scrapy/trunk/scrapy/core/downloader/responsetypes/__init__.py b/scrapy/trunk/scrapy/core/downloader/responsetypes/__init__.py
index fc8e98d33..4c09ebd83 100644
--- a/scrapy/trunk/scrapy/core/downloader/responsetypes/__init__.py
+++ b/scrapy/trunk/scrapy/core/downloader/responsetypes/__init__.py
@@ -16,6 +16,7 @@ class ResponseTypes(object):
CLASSES = {
'text/html': 'scrapy.http.HtmlResponse',
+ 'application/xhtml+xml': 'scrapy.http.HtmlResponse',
'application/xml': 'scrapy.http.XmlResponse',
'text/xml': 'scrapy.http.XmlResponse',
'text': 'scrapy.http.TextResponse',
diff --git a/scrapy/trunk/scrapy/tests/test_responsetypes.py b/scrapy/trunk/scrapy/tests/test_responsetypes.py
index 76c4e7822..14f3cf387 100644
--- a/scrapy/trunk/scrapy/tests/test_responsetypes.py
+++ b/scrapy/trunk/scrapy/tests/test_responsetypes.py
@@ -31,6 +31,7 @@ class ResponseTypesTest(unittest.TestCase):
mappings = [
('text/html; charset=UTF-8', HtmlResponse),
('text/xml; charset=UTF-8', XmlResponse),
+ ('application/xhtml+xml; charset=UTF-8', HtmlResponse),
('application/xml; charset=UTF-8', XmlResponse),
('application/octet-stream', Response),
]