Skip to content

Commit

Permalink
Merge pull request #1134 from vstepanov-lohika-tix/update_build_url
Browse files Browse the repository at this point in the history
Use urljoin to concatenate base_url and path in HttpSession
  • Loading branch information
heyman authored Nov 9, 2019
2 parents 95016a1 + 2c753fb commit ba265c5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
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

0 comments on commit ba265c5

Please sign in to comment.