fix(接口测试): 场景执行插件协议请求时,body 访问错误修复

(cherry picked from commit 85f06fb2a5)
This commit is contained in:
baiqi 2024-07-26 18:27:42 +08:00 committed by Craftsman
parent 24c1e82087
commit 141790c4c9
2 changed files with 5 additions and 5 deletions

View File

@ -1257,9 +1257,9 @@
body: { body: {
...request.body, ...request.body,
jsonBody: { jsonBody: {
...request.body.jsonBody, ...request.body?.jsonBody,
jsonSchema: request.body.jsonBody.jsonSchemaTableData jsonSchema: request.body?.jsonBody?.jsonSchemaTableData
? parseTableDataToJsonSchema(request.body.jsonBody.jsonSchemaTableData[0]) ? parseTableDataToJsonSchema(request.body?.jsonBody?.jsonSchemaTableData?.[0])
: undefined, : undefined,
}, },
}, },

View File

@ -137,8 +137,8 @@ export function getStepDetails(steps: ScenarioStepItem[], details: Record<string
body: { body: {
...currentDetail.body, ...currentDetail.body,
jsonBody: { jsonBody: {
...currentDetail.body.jsonBody, ...currentDetail.body?.jsonBody,
jsonSchema: currentDetail.body.jsonBody.jsonSchema, jsonSchema: currentDetail.body?.jsonBody?.jsonSchema,
jsonSchemaTableData: [], // 原树形结构存在循环引用,这里要去掉以免 axios 序列化失败 jsonSchemaTableData: [], // 原树形结构存在循环引用,这里要去掉以免 axios 序列化失败
}, },
}, },