Skip to content

Commit

Permalink
feat: 发送请求时,浏览器控制台打印值中添加queryParams,来展示get请求的参数 #5
Browse files Browse the repository at this point in the history
  • Loading branch information
BetaGo committed Oct 16, 2019
1 parent 1093bc4 commit 00322bb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ class InterfaceColContent extends Component {
}

onChangeTest = d => {

this.setState({
commonSetting: {
...this.state.commonSetting,
Expand Down Expand Up @@ -974,12 +974,12 @@ class InterfaceColContent extends Component {
>
<div className="common-setting-modal">
<Row className="setting-item">
<Col className="col-item" span="4">
<Col className="col-item" span={4}>
<label>检查HttpCode:&nbsp;<Tooltip title={'检查 http code 是否为 200'}>
<Icon type="question-circle-o" style={{ width: '10px' }} />
</Tooltip></label>
</Col>
<Col className="col-item" span="18">
<Col className="col-item" span={18}>
<Switch onChange={e=>{
let {commonSetting} = this.state;
this.setState({
Expand All @@ -993,29 +993,29 @@ class InterfaceColContent extends Component {
</Row>

<Row className="setting-item">
<Col className="col-item" span="4">
<Col className="col-item" span={4}>
<label>检查返回json:&nbsp;<Tooltip title={'检查接口返回数据字段值,比如检查 code 是不是等于 0'}>
<Icon type="question-circle-o" style={{ width: '10px' }} />
</Tooltip></label>
</Col>
<Col className="col-item" span="6">
<Col className="col-item" span={6}>
<Input value={this.state.commonSetting.checkResponseField.name} onChange={this.changeCommonFieldSetting('name')} placeholder="字段名" />
</Col>
<Col className="col-item" span="6">
<Col className="col-item" span={6}>
<Input onChange={this.changeCommonFieldSetting('value')} value={this.state.commonSetting.checkResponseField.value} placeholder="值" />
</Col>
<Col className="col-item" span="6">
<Col className="col-item" span={6}>
<Switch onChange={this.changeCommonFieldSetting('enable')} checked={this.state.commonSetting.checkResponseField.enable} checkedChildren="开" unCheckedChildren="关" />
</Col>
</Row>

<Row className="setting-item">
<Col className="col-item" span="4">
<Col className="col-item" span={4}>
<label>检查返回数据结构:&nbsp;<Tooltip title={'只有 response 基于 json-schema 方式定义,该检查才会生效'}>
<Icon type="question-circle-o" style={{ width: '10px' }} />
</Tooltip></label>
</Col>
<Col className="col-item" span="18">
<Col className="col-item" span={18}>
<Switch onChange={e=>{
let {commonSetting} = this.state;
this.setState({
Expand All @@ -1029,12 +1029,12 @@ class InterfaceColContent extends Component {
</Row>

<Row className="setting-item">
<Col className="col-item " span="4">
<Col className="col-item " span={4}>
<label>全局测试脚本:&nbsp;<Tooltip title={'在跑自动化测试时,优先调用全局脚本,只有全局脚本通过测试,才会开始跑case自定义的测试脚本'}>
<Icon type="question-circle-o" style={{ width: '10px' }} />
</Tooltip></label>
</Col>
<Col className="col-item" span="14">
<Col className="col-item" span={14}>
<div><Switch onChange={e=>{
let {commonSetting} = this.state;
this.setState({
Expand All @@ -1056,7 +1056,7 @@ class InterfaceColContent extends Component {
}}
/>
</Col>
<Col span="6">
<Col span={6}>
<div className="insert-code">
{InsertCodeMap.map(item => {
return (
Expand Down Expand Up @@ -1295,7 +1295,7 @@ class InterfaceColContent extends Component {
</Row>
<Row type="flex" justify="space-around" className="row" align="middle">
<Col span={21} className="autoTestUrl">
<a
<a
target="_blank"
rel="noopener noreferrer"
href={localUrl + autoTestsUrl} >
Expand Down
6 changes: 4 additions & 2 deletions common/postmanLib.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,10 @@ async function httpRequestByNode(options) {
}),
data: options.data
}
console.log({"axios请求:":axioscontent})
{
let url = URL.parse(axioscontent.url);
console.log({"axios 请求:":{...axioscontent, queryParams: qs.parse(url.query)}});
}
let response = await axios(axioscontent);
return handleRes(response);
} catch (err) {
Expand Down Expand Up @@ -319,7 +322,6 @@ async function crossRequest(defaultOptions, preScript, afterScript,case_pre_scri

let data;


data = await httpRequestByNode(options);
data.req = options;
data.utils=context.utils;
Expand Down

0 comments on commit 00322bb

Please sign in to comment.