File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 1111 cast ,
1212)
1313from unittest .mock import AsyncMock , MagicMock
14+ import urllib .parse
1415
1516import httpx
1617import pytest
@@ -162,6 +163,14 @@ def inner(
162163 def capture_and_mock (* args , ** kwargs ):
163164 request_kwargs .update (kwargs )
164165
166+ # Capture full URL with encoded params while keeping original URL
167+ if kwargs and "params" in kwargs and kwargs ["params" ]:
168+ # Convert params to query string with proper URL encoding
169+ query_string = urllib .parse .urlencode (
170+ kwargs ["params" ], doseq = True , quote_via = urllib .parse .quote_plus
171+ )
172+ request_kwargs .update ({"full_url" : f"{ kwargs ['url' ]} ?{ query_string } " })
173+
165174 return httpx .Response (
166175 status_code = status_code ,
167176 headers = headers ,
You can’t perform that action at this time.
0 commit comments