technical-debt-radar 1.1.0 → 1.1.2-debug.0
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/index.js +17 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -19267,16 +19267,26 @@ var RadarApiClient = class _RadarApiClient {
|
|
|
19267
19267
|
return null;
|
|
19268
19268
|
}
|
|
19269
19269
|
async fetch(path9, init) {
|
|
19270
|
-
const
|
|
19271
|
-
|
|
19272
|
-
|
|
19273
|
-
|
|
19274
|
-
|
|
19275
|
-
|
|
19270
|
+
const url = `${this.apiUrl}${path9}`;
|
|
19271
|
+
const headers = {
|
|
19272
|
+
"Authorization": `Bearer ${this.token}`,
|
|
19273
|
+
"Content-Type": "application/json",
|
|
19274
|
+
...init?.headers
|
|
19275
|
+
};
|
|
19276
|
+
if (process.env.RADAR_DEBUG) {
|
|
19277
|
+
console.log(`[DEBUG] ${init?.method ?? "GET"} ${url}`);
|
|
19278
|
+
console.log(`[DEBUG] Headers: ${JSON.stringify({ Authorization: "Bearer rdr_***", "Content-Type": headers["Content-Type"] })}`);
|
|
19279
|
+
if (init?.body) {
|
|
19280
|
+
const bodyStr = typeof init.body === "string" ? init.body : String(init.body);
|
|
19281
|
+
console.log(`[DEBUG] Body: ${bodyStr.slice(0, 500)}${bodyStr.length > 500 ? "..." : ""}`);
|
|
19276
19282
|
}
|
|
19277
|
-
}
|
|
19283
|
+
}
|
|
19284
|
+
const res = await fetch(url, { ...init, headers });
|
|
19278
19285
|
if (!res.ok) {
|
|
19279
19286
|
const body = await res.text().catch(() => "");
|
|
19287
|
+
if (process.env.RADAR_DEBUG) {
|
|
19288
|
+
console.log(`[DEBUG] Response: ${res.status} ${body.slice(0, 500)}`);
|
|
19289
|
+
}
|
|
19280
19290
|
throw new Error(`API error ${res.status}: ${body}`);
|
|
19281
19291
|
}
|
|
19282
19292
|
return res.json();
|