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