mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-08 09:19:41 +08:00
extract_response when initialize ResponseObject
This commit is contained in:
@@ -3,11 +3,14 @@ from ate import utils, exception
|
||||
|
||||
class ResponseObject(object):
|
||||
|
||||
def __init__(self, resp_obj):
|
||||
def __init__(self, resp_obj, context=None):
|
||||
""" initialize with a requests.Response object
|
||||
@param (requests.Response instance) resp_obj
|
||||
@param (ate.context.Context instance) context
|
||||
"""
|
||||
self.resp_obj = resp_obj
|
||||
if context:
|
||||
self.extract_response(context)
|
||||
|
||||
def parsed_body(self):
|
||||
try:
|
||||
|
||||
@@ -105,8 +105,7 @@ class TestRunner(object):
|
||||
|
||||
resp = self.client.request(url=url, method=method, **req_kwargs)
|
||||
|
||||
resp_obj = response.ResponseObject(resp)
|
||||
resp_obj.extract_response(self.context)
|
||||
resp_obj = response.ResponseObject(resp, self.context)
|
||||
return resp_obj.validate(testcase['response'])
|
||||
|
||||
def run_testset(self, testset):
|
||||
|
||||
Reference in New Issue
Block a user