mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-12 16:01:27 +08:00
fix #196: join base url and path
This commit is contained in:
@@ -6,7 +6,6 @@ import time
|
|||||||
import requests
|
import requests
|
||||||
import urllib3
|
import urllib3
|
||||||
from httprunner import logger
|
from httprunner import logger
|
||||||
from httprunner.compat import urljoin
|
|
||||||
from httprunner.exception import ParamsError
|
from httprunner.exception import ParamsError
|
||||||
from requests import Request, Response
|
from requests import Request, Response
|
||||||
from requests.exceptions import (InvalidSchema, InvalidURL, MissingSchema,
|
from requests.exceptions import (InvalidSchema, InvalidURL, MissingSchema,
|
||||||
@@ -47,7 +46,7 @@ class HttpSession(requests.Session):
|
|||||||
if absolute_http_url_regexp.match(path):
|
if absolute_http_url_regexp.match(path):
|
||||||
return path
|
return path
|
||||||
elif self.base_url:
|
elif self.base_url:
|
||||||
return urljoin(self.base_url, path)
|
return "{}/{}".format(self.base_url.rstrip("/"), path.lstrip("/"))
|
||||||
else:
|
else:
|
||||||
raise ParamsError("base url missed!")
|
raise ParamsError("base url missed!")
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ except ImportError:
|
|||||||
|
|
||||||
if is_py2:
|
if is_py2:
|
||||||
from urllib3.packages.ordered_dict import OrderedDict
|
from urllib3.packages.ordered_dict import OrderedDict
|
||||||
from urlparse import urljoin
|
|
||||||
|
|
||||||
builtin_str = str
|
builtin_str = str
|
||||||
bytes = str
|
bytes = str
|
||||||
@@ -45,7 +44,6 @@ if is_py2:
|
|||||||
|
|
||||||
elif is_py3:
|
elif is_py3:
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from urllib.parse import urljoin
|
|
||||||
|
|
||||||
builtin_str = str
|
builtin_str = str
|
||||||
str = str
|
str = str
|
||||||
|
|||||||
Reference in New Issue
Block a user