Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update build_url function in Locust HttpSession #1134

Merged
merged 2 commits into from
Nov 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions locust/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from requests.exceptions import (InvalidSchema, InvalidURL, MissingSchema,
RequestException)

from six.moves.urllib.parse import urlparse, urlunparse
from six.moves.urllib.parse import urlparse, urlunparse, urljoin

from . import events
from .exception import CatchResponseError, ResponseError
Expand Down Expand Up @@ -69,8 +69,8 @@ def _build_url(self, path):
if absolute_http_url_regexp.match(path):
return path
else:
return "%s%s" % (self.base_url, path)
return urljoin(self.base_url, path)

def request(self, method, url, name=None, catch_response=False, **kwargs):
"""
Constructs and sends a :py:class:`requests.Request`.
Expand Down
4 changes: 2 additions & 2 deletions locust/test/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ def test_connection_error(self):
def test_wrong_url(self):
for url, exception in (
(u"http://\x94", InvalidURL),
("telnet://127.0.0.1", InvalidSchema),
("127.0.0.1", MissingSchema),
("telnet://127.0.0.1", MissingSchema),
("127.0.0.1", MissingSchema),
):
s = HttpSession(url)
try:
Expand Down