前置 URL:环境切换自动拼接服务地址(借鉴 Apifox)
- 环境新增「前置 URL」字段;环境管理弹窗独立配置区 + 说明
- URL 输入改为一体胶囊:前缀块(环境徽标 + 域名,点击进环境管理)+ 分隔线 + 相对路径输入
- 路径以 / 开头(或空)自动拼接当前环境前置 URL;完整 https:// 地址不受影响
- 光标 / 全选只作用于路径,不再误编辑 {{baseUrl}} 文本
- 覆盖 HTTP / GraphQL / SSE 编辑器与发送链路(含自动化测试执行器、代码生成用完整地址)
- 存量数据一次性迁移:{{baseUrl}}/path → /path,baseUrl 变量 → 环境字段(启动 / 导入 / 备份恢复均生效)
- 顶栏切换环境即换前缀;docs 06-env 增前置 URL 章节
- 验证:48 前端用例全绿;本地 E2E(迁移/发送 200/环境切换前缀联动/胶囊几何对齐)+ 近景视觉评审通过
This commit is contained in:
1 parent
1bcd7be2ac
commit
ce6d2d1eff
12 files changed
+260
-35
No files matched your search
@@ -1,3 +1,20 @@
|
||||
## 前置 URL
|
||||
|
||||
环境可配置**前置 URL**(如 `https://api.example.com`)。配置后,请求里只需写相对路径:
|
||||
|
||||
```text
|
||||
前置 URL:https://api.example.com
|
||||
请求路径:/graphql
|
||||
实际请求:https://api.example.com/graphql
|
||||
```
|
||||
|
||||
- URL 输入框会以**前缀块 + 路径**的形式一体展示,前缀部分不可误编辑(点击可跳转环境管理);
|
||||
- **切换环境即自动换成对应服务地址**,无需改请求;
|
||||
- 路径以 `/` 开头(或为空)才启用拼接;写完整 `https://…` 地址的请求不受影响;
|
||||
- 未配置前置 URL 的环境,请求仍可写完整 URL 或用 `{{变量名}}`。
|
||||
|
||||
> 历史数据自动迁移:旧的 `{{baseUrl}}/path` 会被自动转为「前置 URL + /path」,`baseUrl` 变量写入环境的前置 URL 字段。
|
||||
|
||||
## 变量语法
|
||||
|
||||
在 URL、Params、Headers、Cookies、Body、鉴权字段中,使用双花括号引用变量:
|
||||
|
||||
@@ -474,6 +474,41 @@
|
||||
color: var(--accent-strong);
|
||||
}
|
||||
|
||||
/* ---------- URL 胶囊输入(前置 URL 模式) ---------- */
|
||||
.url-pill {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 !important;
|
||||
overflow: visible;
|
||||
min-width: 0;
|
||||
gap: 0;
|
||||
}
|
||||
.url-pill-prefix {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 0 10px;
|
||||
align-self: stretch;
|
||||
background: var(--panel-2);
|
||||
color: var(--text-dim);
|
||||
font-size: 12px;
|
||||
font-family: ui-monospace, monospace;
|
||||
max-width: 46%;
|
||||
min-width: 0;
|
||||
border-radius: 0.5rem 0 0 0.5rem;
|
||||
white-space: nowrap;
|
||||
transition: color 0.15s;
|
||||
}
|
||||
.url-pill-prefix:hover { color: var(--accent-strong); }
|
||||
.url-pill-divider { width: 1px; align-self: stretch; background: var(--border); flex-shrink: 0; }
|
||||
.url-pill-input {
|
||||
border: none !important;
|
||||
background: transparent !important;
|
||||
padding: 0.4rem 0.7rem !important;
|
||||
box-shadow: none !important;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
/* ---------- 自动化测试 ---------- */
|
||||
.test-assert-row {
|
||||
display: flex;
|
||||
|
||||
Reference in new issue
Block a user