apipost-mcp-server-simple 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/apipost-client.js +7 -6
- package/package.json +1 -1
package/dist/apipost-client.js
CHANGED
|
@@ -102,7 +102,12 @@ export class ApipostClient {
|
|
|
102
102
|
await this.loadDefinition();
|
|
103
103
|
}
|
|
104
104
|
const baseUrl = this.getBaseUrl();
|
|
105
|
-
const url = `${baseUrl}${path}`;
|
|
105
|
+
const url = `${baseUrl.replace(/\/$/, '')}${path}`;
|
|
106
|
+
const finalHeaders = {
|
|
107
|
+
'Content-Type': 'application/json',
|
|
108
|
+
...this.globalHeaders,
|
|
109
|
+
...headers,
|
|
110
|
+
};
|
|
106
111
|
// console.error(`正在执行 API: ${method} ${url}`);
|
|
107
112
|
try {
|
|
108
113
|
const response = await axios({
|
|
@@ -110,11 +115,7 @@ export class ApipostClient {
|
|
|
110
115
|
url,
|
|
111
116
|
params,
|
|
112
117
|
data: body,
|
|
113
|
-
headers:
|
|
114
|
-
'Content-Type': 'application/json',
|
|
115
|
-
...this.globalHeaders, // 注入环境变量中的全局 Header
|
|
116
|
-
...headers, // 注入 AI 传递的临时 Header (优先级更高)
|
|
117
|
-
},
|
|
118
|
+
headers: finalHeaders,
|
|
118
119
|
});
|
|
119
120
|
return response.data;
|
|
120
121
|
}
|