refactor(api): fetchAllConfigs 接口从 GET 改为 POST

- 服务端: 新增 FetchAllRequest 结构体,参数通过 JSON body 传递
- 服务端: 路由从 api.GET 改为 api.POST
- Go/Python/Node.js/Java 客户端同步更新为 POST + JSON body
- 与 fetchChangedConfigs 接口风格统一,token 不再暴露在 URL 中
This commit is contained in:
2026-02-20 21:18:43 +08:00
parent b011b3a0b3
commit 08b2ba4c25
7 changed files with 88 additions and 37 deletions
+13 -2
View File
@@ -62,9 +62,20 @@ export class ConfigClient {
}
async fetchAll() {
const url = `${this.config.baseUrl}/api/fetchAllConfigs?appName=${encodeURIComponent(this.config.appName)}&env=${encodeURIComponent(this.config.env)}&version=${encodeURIComponent(this.config.version)}&ignoreGlobal=${this.config.ignoreGlobal}&token=${encodeURIComponent(this.config.token)}`;
const url = `${this.config.baseUrl}/api/fetchAllConfigs`;
const payload = {
appName: this.config.appName,
env: this.config.env,
version: this.config.version,
ignoreGlobal: this.config.ignoreGlobal,
token: this.config.token,
};
const resp = await fetch(url, {
headers: this.config.token ? { Authorization: `Bearer ${this.config.token}` } : {},
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(payload),
signal: AbortSignal.timeout(10000),
});
if (!resp.ok) {