fix(接口定义): 修复推荐断言小数点位精度丢失问题
--bug=1007658 --user=赵勇 【接口测试】推荐json提取和断言会修改数据精度 https://www.tapd.cn/55049933/s/1063804
This commit is contained in:
parent
50740e17b4
commit
0209ea07d0
|
@ -1641,10 +1641,10 @@ public class ApiAutomationService {
|
||||||
|
|
||||||
public ReferenceDTO getReference(ApiScenarioRequest request) {
|
public ReferenceDTO getReference(ApiScenarioRequest request) {
|
||||||
ReferenceDTO dto = new ReferenceDTO();
|
ReferenceDTO dto = new ReferenceDTO();
|
||||||
|
request.setProjectId(null);
|
||||||
dto.setScenarioList(extApiScenarioMapper.selectReference(request));
|
dto.setScenarioList(extApiScenarioMapper.selectReference(request));
|
||||||
QueryTestPlanRequest planRequest = new QueryTestPlanRequest();
|
QueryTestPlanRequest planRequest = new QueryTestPlanRequest();
|
||||||
planRequest.setScenarioId(request.getId());
|
planRequest.setScenarioId(request.getId());
|
||||||
planRequest.setProjectId(request.getProjectId());
|
|
||||||
dto.setTestPlanList(extTestPlanMapper.selectTestPlanByRelevancy(planRequest));
|
dto.setTestPlanList(extTestPlanMapper.selectTestPlanByRelevancy(planRequest));
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,9 @@ export default {
|
||||||
open(objStr) {
|
open(objStr) {
|
||||||
this.data = {};
|
this.data = {};
|
||||||
try {
|
try {
|
||||||
let param = JSON.parse(objStr);
|
// 解决精度丢失问题
|
||||||
|
let stringedJSON = objStr.replace(/:\s*([-+Ee0-9.]+)/g, ': "$1"');
|
||||||
|
let param = JSON.parse(stringedJSON);
|
||||||
if (param instanceof Array) {
|
if (param instanceof Array) {
|
||||||
this.$warning(this.$t('api_test.request.assertions.json_path_err'));
|
this.$warning(this.$t('api_test.request.assertions.json_path_err'));
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue