feat: 测试集 $.key.path 不兼容修改,增加了 params 和 body 去区分请求参数和返回数据

This commit is contained in:
suxiaoxin 2017-10-18 18:21:25 +08:00
parent b5fa4b66b0
commit d2217b47e9
2 changed files with 28 additions and 6 deletions

View File

@ -11,9 +11,13 @@ const CaseReport = function (props) {
let headers = json_format(props.headers, null, ' ');
let res_header = json_format(props.res_header, null, ' ');
let res_body = json_format(props.res_body);
let validRes = props.validRes.map((item, index) => {
let validRes ;
if(props.validRes && Array.isArray(props.validRes)){
validRes = props.validRes.map((item, index) => {
return <div key={index}>{item.message}</div>
})
}
return <div className="report">
<Tabs defaultActiveKey="request" >

View File

@ -3,6 +3,7 @@ import { connect } from 'react-redux';
import PropTypes from 'prop-types'
import { withRouter } from 'react-router'
import { Link } from 'react-router-dom'
import constants from '../../../../constants/variable.js'
import { Tooltip, Icon, Button, Spin, Modal, message ,Select} from 'antd'
import { fetchInterfaceColList, fetchCaseList, setColData } from '../../../../reducer/modules/interfaceCol'
import HTML5Backend from 'react-dnd-html5-backend';
@ -25,7 +26,7 @@ function json_parse(data) {
return data
}
}
const HTTP_METHOD = constants.HTTP_METHOD;
@connect(
@ -154,8 +155,25 @@ class InterfaceColContent extends Component {
status = 'error';
result = e;
}
this.reports[curitem._id] = result;
this.records[curitem._id] = result.res_body;
let query = this.arrToObj(curitem.req_query);
if(!query || typeof query !== 'object'){
query = {};
}
let body = {};
if(HTTP_METHOD[curitem.method].request_body){
body = isJson(curitem.req_body_other);
if(!body || typeof body !== 'object'){
body = {};
}
}
let params = Object.assign({}, query, body);
this.reports = result;
this.records[curitem._id] = {
params: params,
body: result.res_body
};
curitem = Object.assign({}, rows[i], { test_status: status });
newRows = [].concat([], rows);