diff --git a/tests/test_downloader_handlers.py b/tests/test_downloader_handlers.py index e9f890391..bbf641439 100644 --- a/tests/test_downloader_handlers.py +++ b/tests/test_downloader_handlers.py @@ -3,6 +3,7 @@ import os import shutil import sys import tempfile +from base64 import b64encode from typing import Optional, Type from unittest import mock @@ -1237,3 +1238,15 @@ class DataURITestCase(unittest.TestCase): request = Request("data:,") return self.download_request(request, self.spider).addCallback(_test) + + def test_body_mime_type(self): + """Test that the body, and not only the declared MIME type, is taken + into account when choosing a response class.""" + def _test(response): + self.assertIsInstance(response, HtmlResponse) + + html = '\n