mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 02:21:29 +08:00
locusts: support group url
This commit is contained in:
@@ -1 +1 @@
|
||||
__version__ = '0.7.5'
|
||||
__version__ = '0.7.6'
|
||||
@@ -54,7 +54,7 @@ class HttpSession(requests.Session):
|
||||
else:
|
||||
raise ParamsError("base url missed!")
|
||||
|
||||
def request(self, method, url, **kwargs):
|
||||
def request(self, method, url, name=None, **kwargs):
|
||||
"""
|
||||
Constructs and sends a :py:class:`requests.Request`.
|
||||
Returns :py:class:`requests.Response` object.
|
||||
@@ -63,6 +63,8 @@ class HttpSession(requests.Session):
|
||||
method for the new :class:`Request` object.
|
||||
:param url:
|
||||
URL for the new :class:`Request` object.
|
||||
:param name: (optional)
|
||||
Placeholder, make compatible with Locust's HttpSession
|
||||
:param params: (optional)
|
||||
Dictionary or bytes to be sent in the query string for the :class:`Request`.
|
||||
:param data: (optional)
|
||||
|
||||
@@ -97,6 +97,7 @@ class Runner(object):
|
||||
try:
|
||||
url = parsed_request.pop('url')
|
||||
method = parsed_request.pop('method')
|
||||
group_name = parsed_request.pop("group", None)
|
||||
except KeyError:
|
||||
raise exception.ParamsError("URL or METHOD missed!")
|
||||
|
||||
@@ -115,7 +116,12 @@ class Runner(object):
|
||||
for _ in range(run_times):
|
||||
setup_teardown(setup_actions)
|
||||
|
||||
resp = self.http_client_session.request(url=url, method=method, **parsed_request)
|
||||
resp = self.http_client_session.request(
|
||||
method,
|
||||
url,
|
||||
name=group_name,
|
||||
**parsed_request
|
||||
)
|
||||
resp_obj = response.ResponseObject(resp)
|
||||
|
||||
extracted_variables_mapping = resp_obj.extract_response(extractors)
|
||||
|
||||
Reference in New Issue
Block a user