Skip to content

Commit

Permalink
Change request event url field to contain absolute URL not just path.
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberw committed Nov 5, 2021
1 parent 17ea93e commit 17acf45
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions locust/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ def request(self, method, url, name=None, catch_response=False, context={}, **kw
response = self._send_request_safe_mode(method, url, **kwargs)
response_time = (time.perf_counter() - start_perf_counter) * 1000

url_after_redirect = (response.history and response.history[0] or response).request.path_url
request_after_redirect = (response.history and response.history[0] or response).request
url_after_redirect = request_after_redirect.path_url

if self.user:
context = {**self.user.context(), **context}
Expand All @@ -143,7 +144,7 @@ def request(self, method, url, name=None, catch_response=False, context={}, **kw
"response": response,
"exception": None,
"start_time": start_time,
"url": url_after_redirect,
"url": request_after_redirect.url,
}

# get the length of the content, but if the argument stream is set to True, we take
Expand Down
2 changes: 1 addition & 1 deletion locust/contrib/fasthttp.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def request(
"response": response,
"exception": None,
"start_time": start_time,
"url": path, # this is a small deviation from HttpSession, which gets the final (possibly redirected) URL
"url": url, # this is a small deviation from HttpSession, which gets the final (possibly redirected) URL
}

if not allow_redirects:
Expand Down

0 comments on commit 17acf45

Please sign in to comment.