ismx-nexo-node-app 0.4.190 → 0.4.191
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.
|
@@ -38,7 +38,9 @@ class RepositoryRest extends Repository_1.default {
|
|
|
38
38
|
headers.set('Pragma', 'no-cache');
|
|
39
39
|
// Si el body especificado es un objeto, lo convierte a JSON.
|
|
40
40
|
let body = request.body;
|
|
41
|
-
|
|
41
|
+
let isBuffer = typeof Buffer !== 'undefined' && Buffer.isBuffer(request.body);
|
|
42
|
+
let isForm = typeof FormData !== 'undefined' && (request.body instanceof FormData);
|
|
43
|
+
if (!((_d = request.headers) === null || _d === void 0 ? void 0 : _d["Content-Type"]) && request.body && typeof request.body !== 'string' && !isBuffer && !isForm) {
|
|
42
44
|
headers.set('Content-Type', 'application/json');
|
|
43
45
|
body = JSON.stringify(request.body);
|
|
44
46
|
}
|
package/package.json
CHANGED
|
@@ -48,7 +48,9 @@ export default class RepositoryRest<Body=any,Res=any> extends Repository
|
|
|
48
48
|
|
|
49
49
|
// Si el body especificado es un objeto, lo convierte a JSON.
|
|
50
50
|
let body: string | undefined = request.body as string;
|
|
51
|
-
|
|
51
|
+
let isBuffer = typeof Buffer !== 'undefined' && Buffer.isBuffer(request.body);
|
|
52
|
+
let isForm = typeof FormData !== 'undefined' && (request.body instanceof FormData);
|
|
53
|
+
if (!request.headers?.["Content-Type"] && request.body && typeof request.body !== 'string' && !isBuffer && !isForm) {
|
|
52
54
|
headers.set('Content-Type', 'application/json');
|
|
53
55
|
body = JSON.stringify(request.body);
|
|
54
56
|
}
|