@@ -56,6 +56,8 @@ class MockCDNStatus(TypedDict):
5656 requests_total : int
5757 in_flight : int
5858 max_in_flight : int
59+ last_path : str | None
60+ last_query : str | None
5961 last_if_none_match : str | None
6062 last_auth_present : bool
6163 last_source_mode : str | None
@@ -70,6 +72,8 @@ def __init__(self) -> None:
7072 self .requests_total = 0
7173 self .in_flight = 0
7274 self .max_in_flight = 0
75+ self .last_path : str | None = None
76+ self .last_query : str | None = None
7377 self .last_if_none_match : str | None = None
7478 self .last_auth_present = False
7579 self .last_source_mode : str | None = None
@@ -83,6 +87,8 @@ def reset(self) -> None:
8387 self .requests_total = 0
8488 self .in_flight = 0
8589 self .max_in_flight = 0
90+ self .last_path = None
91+ self .last_query = None
8692 self .last_if_none_match = None
8793 self .last_auth_present = False
8894 self .last_source_mode = None
@@ -112,6 +118,8 @@ def record_request(self, headers: Mapping[str, str], path: str) -> tuple[str, in
112118 self .requests_total += 1
113119 self .in_flight += 1
114120 self .max_in_flight = max (self .max_in_flight , self .in_flight )
121+ self .last_path = parsed .path
122+ self .last_query = parsed .query or None
115123 self .last_if_none_match = headers .get ("If-None-Match" )
116124 self .last_auth_present = _has_auth (headers )
117125 self .last_source_mode = source_mode
@@ -135,6 +143,8 @@ def status(self) -> MockCDNStatus:
135143 "requests_total" : self .requests_total ,
136144 "in_flight" : self .in_flight ,
137145 "max_in_flight" : self .max_in_flight ,
146+ "last_path" : self .last_path ,
147+ "last_query" : self .last_query ,
138148 "last_if_none_match" : self .last_if_none_match ,
139149 "last_auth_present" : self .last_auth_present ,
140150 "last_source_mode" : self .last_source_mode ,
@@ -184,14 +194,15 @@ def log_message(self, _format: str, *_args: object) -> None:
184194 return
185195
186196 def _handle_config (self ) -> None :
187- fixture , sequence_index = self .server .state .record_request (dict (self .headers ), self .path )
197+ request_headers = dict (self .headers )
198+ fixture , sequence_index = self .server .state .record_request (request_headers , self .path )
188199 try :
189200 if fixture == "delayed_no_overlap" :
190201 time .sleep (DELAYED_RESPONSE_SECONDS )
191202
192203 status_code , body , headers = _response_for_fixture (
193204 fixture = fixture ,
194- has_auth = _has_auth (self . headers ),
205+ has_auth = _has_auth (request_headers ),
195206 if_none_match = self .headers .get ("If-None-Match" ),
196207 sequence_index = sequence_index ,
197208 )
0 commit comments