mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-03 14:59:38 +08:00
fix: session data in step_datas
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
# encoding: utf-8
|
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
@@ -11,7 +9,7 @@ from requests.exceptions import (InvalidSchema, InvalidURL, MissingSchema,
|
|||||||
|
|
||||||
from httprunner import response
|
from httprunner import response
|
||||||
from httprunner.utils import lower_dict_keys, omit_long_data
|
from httprunner.utils import lower_dict_keys, omit_long_data
|
||||||
from httprunner.v3.schema import SessionData, RequestStat
|
from httprunner.v3.schema import SessionData
|
||||||
|
|
||||||
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||||
|
|
||||||
@@ -103,29 +101,28 @@ class HttpSession(requests.Session):
|
|||||||
"""
|
"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(HttpSession, self).__init__()
|
super(HttpSession, self).__init__()
|
||||||
self.data = SessionData()
|
self.data = None
|
||||||
|
|
||||||
def init_session_data(self):
|
def init_session_data(self):
|
||||||
""" initialize session data, it will store detail data of request and response
|
""" initialize session data, it will store detail data of request and response
|
||||||
"""
|
"""
|
||||||
self.data.name = ""
|
self.data = SessionData(
|
||||||
self.data.req_resp = [
|
req_resp=[
|
||||||
{
|
{
|
||||||
"request": {
|
"request": {
|
||||||
"url": "N/A",
|
"url": "N/A",
|
||||||
"method": "N/A",
|
"method": "N/A",
|
||||||
"headers": {}
|
"headers": {}
|
||||||
},
|
},
|
||||||
"response": {
|
"response": {
|
||||||
"status_code": "N/A",
|
"status_code": "N/A",
|
||||||
"headers": {},
|
"headers": {},
|
||||||
"encoding": None,
|
"encoding": None,
|
||||||
"content_type": ""
|
"content_type": ""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
]
|
)
|
||||||
self.data.validators = {}
|
|
||||||
self.data.stat = RequestStat()
|
|
||||||
|
|
||||||
def update_last_req_resp_record(self, resp_obj):
|
def update_last_req_resp_record(self, resp_obj):
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user