vpsnet-mcp 1.0.0 → 1.0.1
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/build/api.js +8 -1
- package/package.json +1 -1
package/build/api.js
CHANGED
|
@@ -16,7 +16,14 @@ export async function apiRequest(method, path, body) {
|
|
|
16
16
|
init.body = JSON.stringify(body);
|
|
17
17
|
}
|
|
18
18
|
const res = await fetch(url, init);
|
|
19
|
-
const
|
|
19
|
+
const text = await res.text();
|
|
20
|
+
let data;
|
|
21
|
+
try {
|
|
22
|
+
data = text ? JSON.parse(text) : null;
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
data = { error: text || res.statusText };
|
|
26
|
+
}
|
|
20
27
|
return { status: res.status, data };
|
|
21
28
|
}
|
|
22
29
|
export function formatJson(data) {
|