intelicoreact 1.3.87 → 1.3.89

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.
@@ -90,17 +90,25 @@ class ApiUtils extends _Utils.default {
90
90
  //? Планируется, что метод будет использоваться неизменно, однако технически его можно перегрузить на экземпляре
91
91
  //? Метод планировался как асинхронный
92
92
  async getResponseBody(response, getBodyAs) {
93
+ //? Если response не экземпляр Response, то вернуть по факту
93
94
  if (!(response instanceof Response)) return response;
95
+
96
+ //? В этом месте все методы должны быть, т.к. response точно экземпляр Response.
97
+ //? А вот contentType-а походу может не быть. Наверное...
94
98
  const contentType = response.headers.get("content-type");
95
99
  if (!contentType) return "";
100
+
101
+ // ToDo - ошибка была в получении executor-а...
102
+ // ToDo - Все было через if. В случае, если не попадало ни в одну if-ку, то возвращался undefined по умолчанию,
103
+ // ToDo - а после этот undefined пытался запустить через call...
96
104
  const executor = (() => {
97
105
  if (typeof getBodyAs === 'string' && getBodyAs in response && typeof response[getBodyAs] === 'function') {
98
106
  return response[getBodyAs];
99
107
  }
100
- if (contentType !== null && contentType !== void 0 && contentType.includes('text/csv')) {
108
+ if (typeof contentType === 'string' && contentType.includes('text/csv')) {
101
109
  return response.blob;
102
110
  }
103
- if (contentType) return contentType.includes("json") ? response.json : response.text;
111
+ return typeof contentType === 'string' && contentType.includes('json') ? response.json : response.text;
104
112
  })();
105
113
 
106
114
  // обработка случаев краша метода json при отсутствии тела ответа
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intelicoreact",
3
- "version": "1.3.87",
3
+ "version": "1.3.89",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [