Merge pull request #1333 from demelziraptor/x-json-response

interpreting application/x-json as TextResponse
This commit is contained in:
Daniel Graña 2015-07-02 15:20:47 -03:00
commit 2a7dc31f4c
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)