From 86baef02a04dd5566e5ad8568011223cc29723f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Chaves?= Date: Tue, 10 Jan 2023 20:51:43 +0100 Subject: [PATCH] Test Content-Encoding against Content-Disposition, URL and body --- tests/test_utils_response.py | 37 ++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tests/test_utils_response.py b/tests/test_utils_response.py index c4a66184d..53366d428 100644 --- a/tests/test_utils_response.py +++ b/tests/test_utils_response.py @@ -500,6 +500,43 @@ POST_XTRACTMIME_SCENARIOS = ( ) ), + # Compressed content should be of type Response until uncompressed. + ( + { + 'headers': Headers( + { + 'Content-Disposition': [ + 'attachment; filename="a.html"', + ], + 'Content-Encoding': ['zip'], + } + ) + }, + Response, + ), + ( + { + "url": "file:///a.html", + 'headers': Headers( + { + 'Content-Encoding': ['zip'], + } + ) + }, + Response, + ), + ( + { + "body": b"", + 'headers': Headers( + { + 'Content-Encoding': ['zip'], + } + ) + }, + Response, + ), + # If the body is empty, it contains no binary data bytes, hence body-based # MIME type detection must interpret the result as text. #