Skip to content

🕷️ The BEST Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scrapling_dev

test: add request fingerprint regressions

yetvala5a565299645
diff --git a/tests/spiders/test_request.py b/tests/spiders/test_request.py
index 997a71b..f54f2cd 100644
--- a/tests/spiders/test_request.py
+++ b/tests/spiders/test_request.py
@@ -99,6 +99,20 @@ class TestRequestProperties:
r2 = Request("https://example.com/page2")
assert r1.update_fingerprint() != r2.update_fingerprint()
+ def test_fingerprint_include_kwargs_uses_kwarg_values(self):
+ """Test kwargs with different values produce different fingerprints."""
+ r1 = Request("https://example.com", timeout=1)
+ r2 = Request("https://example.com", timeout=2)
+
+ assert r1.update_fingerprint(include_kwargs=True) != r2.update_fingerprint(include_kwargs=True)
+
+ def test_fingerprint_include_headers_preserves_header_value_case(self):
+ """Test header values are fingerprinted without lowercasing."""
+ r1 = Request("https://example.com", headers={"X-Test": "A"})
+ r2 = Request("https://example.com", headers={"X-Test": "a"})
+
+ assert r1.update_fingerprint(include_headers=True) != r2.update_fingerprint(include_headers=True)
+
class TestRequestCopy:
"""Test Request copy functionality."""