interpreting application/x-json as TextResponse

This commit is contained in:
Demelziraptor 2015-07-02 19:51:49 +02:00
parent 3fc4e0b319
commit 9a15fcf89a
2 changed files with 2 additions and 0 deletions

View File

@ -24,6 +24,7 @@ class ResponseTypes(object):
'application/vnd.wap.xhtml+xml': 'scrapy.http.HtmlResponse',
'application/xml': 'scrapy.http.XmlResponse',
'application/json': 'scrapy.http.TextResponse',
'application/x-json': 'scrapy.http.TextResponse',
'application/javascript': 'scrapy.http.TextResponse',
'application/x-javascript': 'scrapy.http.TextResponse',
'text/xml': 'scrapy.http.XmlResponse',

View File

@ -35,6 +35,7 @@ class ResponseTypesTest(unittest.TestCase):
('application/vnd.wap.xhtml+xml; charset=utf-8', HtmlResponse),
('application/xml; charset=UTF-8', XmlResponse),
('application/octet-stream', Response),
('application/x-json; encoding=UTF8;charset=UTF-8', TextResponse),
]
for source, cls in mappings:
retcls = responsetypes.from_content_type(source)