@djangocfg/monitor 2.1.308 → 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.cjs CHANGED
@@ -365,7 +365,7 @@ var Monitor = _Monitor;
365
365
  // src/_api/generated/cfg_monitor/http.ts
366
366
  var _FetchAdapter = class _FetchAdapter {
367
367
  async request(request) {
368
- const { method, url, headers, body, params, formData, binaryBody } = request;
368
+ const { method, url, headers, body, params, formData, binaryBody, responseType } = request;
369
369
  let finalUrl = url;
370
370
  if (params) {
371
371
  const searchParams = new URLSearchParams();
@@ -398,11 +398,21 @@ var _FetchAdapter = class _FetchAdapter {
398
398
  // Include Django session cookies
399
399
  });
400
400
  let data = null;
401
- const contentType = response.headers.get("content-type");
402
- if (response.status !== 204 && contentType?.includes("application/json")) {
403
- data = await response.json();
404
- } else if (response.status !== 204) {
405
- data = await response.text();
401
+ const contentType = response.headers.get("content-type") ?? "";
402
+ if (response.status !== 204) {
403
+ if (responseType === "blob") {
404
+ data = await response.blob();
405
+ } else if (responseType === "text") {
406
+ data = await response.text();
407
+ } else if (responseType === "json") {
408
+ data = await response.json();
409
+ } else if (contentType.includes("application/json")) {
410
+ data = await response.json();
411
+ } else if (contentType.startsWith("text/")) {
412
+ data = await response.text();
413
+ } else {
414
+ data = await response.blob();
415
+ }
406
416
  }
407
417
  const responseHeaders = {};
408
418
  response.headers.forEach((value, key) => {
@@ -960,7 +970,8 @@ var _APIClient = class _APIClient {
960
970
  params: options?.params,
961
971
  body: options?.body,
962
972
  formData: options?.formData,
963
- binaryBody: options?.binaryBody
973
+ binaryBody: options?.binaryBody,
974
+ responseType: options?.responseType
964
975
  });
965
976
  const duration = Date.now() - startTime;
966
977
  if (response.status >= 400) {
@@ -1385,7 +1396,7 @@ __name(sendBatch, "sendBatch");
1385
1396
  // src/client/utils/env.ts
1386
1397
  var isDevelopment = process.env.NODE_ENV === "development";
1387
1398
  var isProduction = !isDevelopment;
1388
- var MONITOR_VERSION = "2.1.308";
1399
+ var MONITOR_VERSION = "2.1.310";
1389
1400
 
1390
1401
  // src/client/constants.ts
1391
1402
  var MONITOR_INGEST_PATTERN = /cfg\/monitor\/ingest/;