datatracker/patch/fix-request-profiler-streaming-length.patch
2020-04-20 17:51:47 +00:00

24 lines
1 KiB
Diff

--- request_profiler/models.py.old 2020-04-20 13:39:17.844147379 +0200
+++ request_profiler/models.py 2020-04-20 13:39:50.749093653 +0200
@@ -181,7 +181,7 @@
"""Extract values from HttpRequest and store locally."""
self.request = request
self.http_method = request.method
- self.request_uri = request.path
+ self.request_uri = request.path[:200]
self.query_string = request.META.get("QUERY_STRING", "")
self.http_user_agent = request.META.get("HTTP_USER_AGENT", "")[:400]
# we care about the domain more than the URL itself, so truncating
@@ -206,7 +206,10 @@
"""Extract values from HttpResponse and store locally."""
self.response = response
self.response_status_code = response.status_code
- self.response_content_length = len(response.content)
+ if hasattr(response, 'content'):
+ self.response_content_length = len(response.content)
+ else:
+ self.response_content_length = -1
return self
def stop(self):