@@ -156,9 +156,8 @@ def callback_on_url_match(data):
156156 body = data ['request' ].get ('body' , None )
157157 request = Request (request_id , url , method , headers , body , self )
158158 callback (request )
159- callback_id = self .__on ('before_request' , callback_on_url_match )
160- request_id = callback_id
161- self .callbacks [callback_id ] = callback
159+ request_id = self .__on ('before_request' , callback_on_url_match )
160+ self .callbacks [request_id ] = callback
162161 if 'before_request' not in self .subscriptions or not self .subscriptions .get ('before_request' ):
163162 self .subscriptions ['before_request' ] = [request_id ]
164163 else :
@@ -199,9 +198,8 @@ def callback_on_url_match(data):
199198 headers = data ['response' ].get ('headers' , {})
200199 response = Response (request_id , url , status_code , headers , body , self )
201200 callback (response )
202- callback_id = self .__on ('response_started' , callback_on_url_match )
203- request_id = callback_id
204- self .callbacks [callback_id ] = callback
201+ request_id = self .__on ('response_started' , callback_on_url_match )
202+ self .callbacks [request_id ] = callback
205203 if 'response_started' not in self .subscriptions or not self .subscriptions .get ('response_started' ):
206204 self .subscriptions ['response_started' ] = [request_id ]
207205 else :
0 commit comments