+
@@ -545,6 +545,7 @@
defaultHeaderParamsItem,
defaultKeyValueParamItem,
defaultRequestParamsItem,
+ defaultResponse,
} from '@/views/api-test/components/config';
import { filterKeyValParams, parseRequestBodyFiles } from '@/views/api-test/components/utils';
import type { Api } from '@form-create/arco-design';
@@ -876,22 +877,16 @@
function handleUrlChange(val: string) {
const params = parseQueryParams(val.trim());
if (params.length > 0) {
- requestVModel.value.query.splice(
- 0,
- requestVModel.value.query.length - 2,
+ requestVModel.value.query = [
...params.map((e, i) => ({
id: (new Date().getTime() + i).toString(),
- paramType: RequestParamsType.STRING,
- description: '',
- required: false,
- maxLength: undefined,
- minLength: undefined,
- encode: false,
- enable: true,
+ ...defaultRequestParamsItem,
...e,
- }))
- );
+ })),
+ cloneDeep(defaultRequestParamsItem),
+ ];
requestVModel.value.activeTab = RequestComposition.QUERY;
+ [requestVModel.value.url] = val.split('?');
}
handleActiveDebugChange();
}
@@ -1151,6 +1146,7 @@
if (isHttpProtocol.value) {
try {
requestVModel.value.executeLoading = true;
+ requestVModel.value.response = cloneDeep(defaultResponse);
const res = await props.executeApi(makeRequestParams(executeType));
if (executeType === 'localExec') {
await props.localExecuteApi(localExecuteUrl.value, res);
@@ -1166,6 +1162,7 @@
if (valid === true) {
try {
requestVModel.value.executeLoading = true;
+ requestVModel.value.response = cloneDeep(defaultResponse);
const res = await props.executeApi(makeRequestParams(executeType));
if (executeType === 'localExec') {
await props.localExecuteApi(localExecuteUrl.value, res);
@@ -1518,4 +1515,9 @@
@apply hidden;
}
}
+ .show-second {
+ :deep(.arco-split-trigger) {
+ @apply block;
+ }
+ }
diff --git a/frontend/src/views/api-test/components/requestComposition/response/edit.vue b/frontend/src/views/api-test/components/requestComposition/response/edit.vue
index 990935ed82..df89581de1 100644
--- a/frontend/src/views/api-test/components/requestComposition/response/edit.vue
+++ b/frontend/src/views/api-test/components/requestComposition/response/edit.vue
@@ -178,6 +178,7 @@
import paramTable, { ParamTableColumn } from '@/views/api-test/components/paramTable.vue';
import popConfirm from '@/views/api-test/components/popConfirm.vue';
+ import { responseHeaderOption } from '@/config/apiTest';
import { useI18n } from '@/hooks/useI18n';
import useAppStore from '@/store/modules/app';
@@ -397,7 +398,8 @@
title: 'apiTestManagement.paramName',
dataIndex: 'key',
slotName: 'key',
- inputType: 'input',
+ inputType: 'autoComplete',
+ autoCompleteParams: responseHeaderOption,
},
{
title: 'apiTestManagement.paramVal',
diff --git a/frontend/src/views/api-test/debug/index.vue b/frontend/src/views/api-test/debug/index.vue
index ffe867ca50..9fe811978e 100644
--- a/frontend/src/views/api-test/debug/index.vue
+++ b/frontend/src/views/api-test/debug/index.vue
@@ -133,6 +133,7 @@
ResponseComposition,
} from '@/enums/apiEnum';
+ import { defaultBodyParams, defaultResponse } from '../components/config';
import { parseRequestBodyFiles } from '../components/utils';
const { t } = useI18n();
@@ -150,50 +151,6 @@
}
const initDefaultId = `debug-${Date.now()}`;
- const defaultBodyParams: ExecuteBody = {
- bodyType: RequestBodyFormat.NONE,
- formDataBody: {
- formValues: [],
- },
- wwwFormBody: {
- formValues: [],
- },
- jsonBody: {
- jsonValue: '',
- },
- xmlBody: { value: '' },
- binaryBody: {
- description: '',
- file: undefined,
- },
- rawBody: { value: '' },
- };
- const defaultResponse: RequestTaskResult = {
- requestResults: [
- {
- body: '',
- headers: '',
- url: '',
- method: '',
- responseResult: {
- body: '',
- contentType: '',
- headers: '',
- dnsLookupTime: 0,
- downloadTime: 0,
- latency: 0,
- responseCode: 0,
- responseTime: 0,
- responseSize: 0,
- socketInitTime: 0,
- sslHandshakeTime: 0,
- tcpHandshakeTime: 0,
- transferStartTime: 0,
- },
- },
- ],
- console: '',
- }; // 调试返回的响应内容
const defaultDebugParams: RequestParam = {
id: initDefaultId,
moduleId: 'root',
diff --git a/frontend/src/views/api-test/management/components/management/api/index.vue b/frontend/src/views/api-test/management/components/management/api/index.vue
index 7f7036b4ec..6a689f6aad 100644
--- a/frontend/src/views/api-test/management/components/management/api/index.vue
+++ b/frontend/src/views/api-test/management/components/management/api/index.vue
@@ -92,7 +92,7 @@
ResponseComposition,
} from '@/enums/apiEnum';
- import { defaultResponseItem } from '@/views/api-test/components/config';
+ import { defaultBodyParams, defaultResponse, defaultResponseItem } from '@/views/api-test/components/config';
import type { RequestParam } from '@/views/api-test/components/requestComposition/index.vue';
import { parseRequestBodyFiles } from '@/views/api-test/components/utils';
// 懒加载requestComposition组件
@@ -138,51 +138,6 @@
});
const initDefaultId = `definition-${Date.now()}`;
- const defaultBodyParams: ExecuteBody = {
- bodyType: RequestBodyFormat.NONE,
- formDataBody: {
- formValues: [],
- },
- wwwFormBody: {
- formValues: [],
- },
- jsonBody: {
- jsonValue: '',
- },
- xmlBody: { value: '' },
- binaryBody: {
- description: '',
- file: undefined,
- },
- rawBody: { value: '' },
- };
- // 调试返回的响应内容
- const defaultResponse: RequestTaskResult = {
- requestResults: [
- {
- body: '',
- headers: '',
- method: '',
- url: '',
- responseResult: {
- body: '',
- contentType: '',
- headers: '',
- dnsLookupTime: 0,
- downloadTime: 0,
- latency: 0,
- responseCode: 0,
- responseTime: 0,
- responseSize: 0,
- socketInitTime: 0,
- tcpHandshakeTime: 0,
- transferStartTime: 0,
- sslHandshakeTime: 0,
- },
- },
- ],
- console: '',
- };
const defaultDefinitionParams: RequestParam = {
id: initDefaultId,
moduleId: props.activeModule === 'all' ? 'root' : props.activeModule,
diff --git a/frontend/src/views/api-test/management/components/moduleTree.vue b/frontend/src/views/api-test/management/components/moduleTree.vue
index 3f6f9d8ee8..67b93e743e 100644
--- a/frontend/src/views/api-test/management/components/moduleTree.vue
+++ b/frontend/src/views/api-test/management/components/moduleTree.vue
@@ -313,10 +313,10 @@
label: 'apiTestManagement.share',
eventTag: 'share',
},
- {
- label: 'apiTestManagement.shareModule',
- eventTag: 'shareModule',
- },
+ // {
+ // label: 'apiTestManagement.shareModule',
+ // eventTag: 'shareModule',
+ // }, // TODO:第一版没有文档,不需要分享模块
{
isDivider: true,
},