ismx-nexo-node-app 0.4.92 → 0.4.93
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.
|
@@ -34,14 +34,14 @@ class RepositoryRest extends Repository_1.default {
|
|
|
34
34
|
let headers = new Headers(request.headers);
|
|
35
35
|
headers.set('Cache-Control', 'no-cache');
|
|
36
36
|
headers.set('Pragma', 'no-cache');
|
|
37
|
-
for (const header of Object.keys(headers))
|
|
38
|
-
headers.set(header, (_e = (_d = request.headers) === null || _d === void 0 ? void 0 : _d[header]) !== null && _e !== void 0 ? _e : "");
|
|
39
37
|
// Si el body especificado es un objeto, lo convierte a JSON.
|
|
40
38
|
let body = request.body;
|
|
41
39
|
if (request.body && typeof request.body !== 'string' && (typeof Buffer === 'undefined' || !Buffer.isBuffer(request.body))) {
|
|
42
40
|
headers.set('Content-Type', 'application/json');
|
|
43
41
|
body = JSON.stringify(request.body);
|
|
44
42
|
}
|
|
43
|
+
for (const header of Object.keys(headers))
|
|
44
|
+
headers.set(header, (_e = (_d = request.headers) === null || _d === void 0 ? void 0 : _d[header]) !== null && _e !== void 0 ? _e : "");
|
|
45
45
|
// Realiza la llamada a la API con las cabeceras y la URL base de la llamada.
|
|
46
46
|
let call = fetch(this.baseUrl + endpoint + QueryUtils_1.default.map(request.query), Object.assign(Object.assign({}, request), { body: method !== "GET" ? body : undefined, headers }));
|
|
47
47
|
// Añade información adicional a la respuesta y devuelve el resultado (o el error en su caso).
|
package/package.json
CHANGED
|
@@ -42,8 +42,6 @@ export default class RepositoryRest<Body=any,Res=any> extends Repository
|
|
|
42
42
|
let headers = new Headers(request.headers);
|
|
43
43
|
headers.set('Cache-Control', 'no-cache');
|
|
44
44
|
headers.set('Pragma', 'no-cache');
|
|
45
|
-
for (const header of Object.keys(headers))
|
|
46
|
-
headers.set(header, request.headers?.[header] ?? "");
|
|
47
45
|
|
|
48
46
|
// Si el body especificado es un objeto, lo convierte a JSON.
|
|
49
47
|
let body: string | undefined = request.body as string;
|
|
@@ -52,6 +50,9 @@ export default class RepositoryRest<Body=any,Res=any> extends Repository
|
|
|
52
50
|
body = JSON.stringify(request.body);
|
|
53
51
|
}
|
|
54
52
|
|
|
53
|
+
for (const header of Object.keys(headers))
|
|
54
|
+
headers.set(header, request.headers?.[header] ?? "");
|
|
55
|
+
|
|
55
56
|
// Realiza la llamada a la API con las cabeceras y la URL base de la llamada.
|
|
56
57
|
let call = fetch(this.baseUrl + endpoint + QueryUtils.map(request.query), {
|
|
57
58
|
...request, body: method !== "GET" ? body : undefined, headers
|