fix(接口自动化): 修复执行类型为空时错误

This commit is contained in:
fit2-zhao 2020-12-31 10:44:20 +08:00
parent 3f80c98d76
commit d3cd2f4843
3 changed files with 8 additions and 6 deletions

View File

@ -181,11 +181,13 @@ public class MsHTTPSamplerProxy extends MsTestElement {
}
// 请求体
if (!StringUtils.equals(this.getMethod(), "GET")) {
List<KeyValue> bodyParams = this.body.getBodyParams(sampler, this.getId());
if (this.body.getType().equals("Form Data")) {
sampler.setDoMultipart(true);
if (this.body != null) {
List<KeyValue> bodyParams = this.body.getBodyParams(sampler, this.getId());
if (StringUtils.isNotEmpty(this.body.getType()) && this.body.getType().equals("Form Data")) {
sampler.setDoMultipart(true);
}
sampler.setArguments(httpArguments(bodyParams));
}
sampler.setArguments(httpArguments(bodyParams));
}
final HashTree httpSamplerTree = tree.add(sampler);

View File

@ -27,7 +27,7 @@
computed: {
error() {
return this.response.responseCode >= 400;
return this.response && this.response.responseCode && this.response.responseCode >= 400;
}
}
}

View File

@ -41,7 +41,7 @@
</div>
<div class="ms-div">
Body :
<pre>{{response.body}}</pre>
<pre>{{response.body ? response.body:""}}</pre>
</div>
</el-tab-pane>