fix(parser): handle responses with empty body

It makes root's value None
This commit is contained in:
Karim shoair
2026-01-13 02:35:26 +02:00
parent 35d570120a
commit dac854a129
+1 -1
View File
@@ -138,7 +138,7 @@ class Selector(SelectorsGeneration):
default_doctype=True,
strip_cdata=(not keep_cdata),
)
self._root = cast(HtmlElement, fromstring(body, parser=parser, base_url=url or None))
self._root = cast(HtmlElement, fromstring(body or "<html/>", parser=parser, base_url=url or None))
self._raw_body = content
else: