@djangocfg/monitor 2.1.309 → 2.1.310

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/client.mjs CHANGED
@@ -342,7 +342,7 @@ var Monitor = _Monitor;
342
342
  // src/_api/generated/cfg_monitor/http.ts
343
343
  var _FetchAdapter = class _FetchAdapter {
344
344
  async request(request) {
345
- const { method, url, headers, body, params, formData, binaryBody } = request;
345
+ const { method, url, headers, body, params, formData, binaryBody, responseType } = request;
346
346
  let finalUrl = url;
347
347
  if (params) {
348
348
  const searchParams = new URLSearchParams();
@@ -375,11 +375,21 @@ var _FetchAdapter = class _FetchAdapter {
375
375
  // Include Django session cookies
376
376
  });
377
377
  let data = null;
378
- const contentType = response.headers.get("content-type");
379
- if (response.status !== 204 && contentType?.includes("application/json")) {
380
- data = await response.json();
381
- } else if (response.status !== 204) {
382
- data = await response.text();
378
+ const contentType = response.headers.get("content-type") ?? "";
379
+ if (response.status !== 204) {
380
+ if (responseType === "blob") {
381
+ data = await response.blob();
382
+ } else if (responseType === "text") {
383
+ data = await response.text();
384
+ } else if (responseType === "json") {
385
+ data = await response.json();
386
+ } else if (contentType.includes("application/json")) {
387
+ data = await response.json();
388
+ } else if (contentType.startsWith("text/")) {
389
+ data = await response.text();
390
+ } else {
391
+ data = await response.blob();
392
+ }
383
393
  }
384
394
  const responseHeaders = {};
385
395
  response.headers.forEach((value, key) => {
@@ -937,7 +947,8 @@ var _APIClient = class _APIClient {
937
947
  params: options?.params,
938
948
  body: options?.body,
939
949
  formData: options?.formData,
940
- binaryBody: options?.binaryBody
950
+ binaryBody: options?.binaryBody,
951
+ responseType: options?.responseType
941
952
  });
942
953
  const duration = Date.now() - startTime;
943
954
  if (response.status >= 400) {
@@ -1362,7 +1373,7 @@ __name(sendBatch, "sendBatch");
1362
1373
  // src/client/utils/env.ts
1363
1374
  var isDevelopment = process.env.NODE_ENV === "development";
1364
1375
  var isProduction = !isDevelopment;
1365
- var MONITOR_VERSION = "2.1.309";
1376
+ var MONITOR_VERSION = "2.1.310";
1366
1377
 
1367
1378
  // src/client/constants.ts
1368
1379
  var MONITOR_INGEST_PATTERN = /cfg\/monitor\/ingest/;