mirror of
				https://github.com/zulip/zulip.git
				synced 2025-10-30 11:33:51 +00:00 
			
		
		
		
	request: Refactor to record rate limit data using ZulipRequestNotes.
We will no longer use the HttpRequest to store the rate limit data. Using ZulipRequestNotes, we can access rate_limit and ratelimits_applied with type hints support. We also save the process of initializing ratelimits_applied by giving it a default value.
This commit is contained in:
		| @@ -544,8 +544,9 @@ class RateLimitMiddleware(MiddlewareMixin): | ||||
|             return response | ||||
|  | ||||
|         # Add X-RateLimit-*** headers | ||||
|         if hasattr(request, "_ratelimits_applied"): | ||||
|             self.set_response_headers(response, request._ratelimits_applied) | ||||
|         ratelimits_applied = get_request_notes(request).ratelimits_applied | ||||
|         if len(ratelimits_applied) > 0: | ||||
|             self.set_response_headers(response, ratelimits_applied) | ||||
|  | ||||
|         return response | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user