fix: fixing the response logic

This commit is contained in:
Karim shoair
2025-11-10 03:03:05 +02:00
parent 026161c8f8
commit d018d6e438
+4 -4
View File
@@ -115,10 +115,10 @@ class ResponseFactory:
history = cls._process_response_history(first_response, parser_arguments)
try:
if "html" in final_response.headers.get("content-type", ""):
if "html" in final_response.all_headers().get("content-type", ""):
page_content = cls._get_page_content(page)
else:
page_content = final_response.text()
page_content = final_response.body()
except Exception as e: # pragma: no cover
log.error(f"Error getting page content: {e}")
page_content = ""
@@ -250,10 +250,10 @@ class ResponseFactory:
history = await cls._async_process_response_history(first_response, parser_arguments)
try:
if "html" in final_response.headers.get("content-type", ""):
if "html" in (await final_response.all_headers()).get("content-type", ""):
page_content = await cls._get_async_page_content(page)
else:
page_content = await final_response.text()
page_content = await final_response.body()
except Exception as e: # pragma: no cover
log.error(f"Error getting page content in async: {e}")
page_content = ""