mirror of https://github.com/scrapy/scrapy.git
Cover additional behavior changes in tests
This commit is contained in:
parent
86baef02a0
commit
7bb5289ced
|
|
@ -450,6 +450,16 @@ POST_XTRACTMIME_SCENARIOS = (
|
|||
'application/ld+json',
|
||||
)
|
||||
),
|
||||
|
||||
# XML MIME types should trigger an XmlResponse.
|
||||
#
|
||||
# https://mimesniff.spec.whatwg.org/#xml-mime-type
|
||||
*(
|
||||
(mime_type, XmlResponse)
|
||||
for mime_type in (
|
||||
'application/foo+xml',
|
||||
)
|
||||
),
|
||||
)
|
||||
),
|
||||
|
||||
|
|
@ -500,6 +510,21 @@ POST_XTRACTMIME_SCENARIOS = (
|
|||
)
|
||||
),
|
||||
|
||||
# Content-Type also triumphs Content-Disposition.
|
||||
(
|
||||
{
|
||||
'headers': Headers(
|
||||
{
|
||||
'Content-Disposition': [
|
||||
'attachment; filename="a.html"',
|
||||
],
|
||||
'Content-Type': ['application/octet-stream'],
|
||||
}
|
||||
)
|
||||
},
|
||||
Response,
|
||||
),
|
||||
|
||||
# Compressed content should be of type Response until uncompressed.
|
||||
(
|
||||
{
|
||||
|
|
@ -514,17 +539,6 @@ POST_XTRACTMIME_SCENARIOS = (
|
|||
},
|
||||
Response,
|
||||
),
|
||||
(
|
||||
{
|
||||
"url": "file:///a.html",
|
||||
'headers': Headers(
|
||||
{
|
||||
'Content-Encoding': ['zip'],
|
||||
}
|
||||
)
|
||||
},
|
||||
Response,
|
||||
),
|
||||
(
|
||||
{
|
||||
"body": b"<html>",
|
||||
|
|
@ -595,6 +609,28 @@ POST_XTRACTMIME_SCENARIOS = (
|
|||
)
|
||||
),
|
||||
|
||||
# File extension triumphs body.
|
||||
(
|
||||
{
|
||||
"body": b"<html>",
|
||||
'headers': Headers(
|
||||
{
|
||||
'Content-Disposition': [
|
||||
'attachment; filename="a.gz"',
|
||||
],
|
||||
}
|
||||
)
|
||||
},
|
||||
Response,
|
||||
),
|
||||
(
|
||||
{
|
||||
"body": b"<html>",
|
||||
'url': 'file:///a.gz',
|
||||
},
|
||||
Response,
|
||||
),
|
||||
|
||||
# Without anything else, the body determines the response class.
|
||||
*(
|
||||
({"body": body}, response_class)
|
||||
|
|
|
|||
Loading…
Reference in New Issue