ismx-nexo-node-app 0.3.67 → 0.3.68
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.
|
@@ -75,6 +75,16 @@ class BusinessErrors {
|
|
|
75
75
|
this.except("0013");
|
|
76
76
|
return body;
|
|
77
77
|
}
|
|
78
|
+
getBodyParam(param, body) {
|
|
79
|
+
let path = param.split(".");
|
|
80
|
+
let value = body;
|
|
81
|
+
for (let key of path) {
|
|
82
|
+
value = value[key];
|
|
83
|
+
if (value === undefined || value === null)
|
|
84
|
+
this.except("0014", param);
|
|
85
|
+
}
|
|
86
|
+
return value;
|
|
87
|
+
}
|
|
78
88
|
getHeaders(key, headers) {
|
|
79
89
|
if (!headers[key])
|
|
80
90
|
this.except("0015", key);
|
package/package.json
CHANGED
|
@@ -72,6 +72,16 @@ export default class BusinessErrors {
|
|
|
72
72
|
return body!;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
getBodyParam(param: string, body: any): any {
|
|
76
|
+
let path = param.split(".");
|
|
77
|
+
let value = body;
|
|
78
|
+
for (let key of path) {
|
|
79
|
+
value = value[key];
|
|
80
|
+
if (value === undefined || value === null) this.except("0014", param);
|
|
81
|
+
}
|
|
82
|
+
return value;
|
|
83
|
+
}
|
|
84
|
+
|
|
75
85
|
getHeaders(key: string, headers: {[key: string]: string}): string {
|
|
76
86
|
if (!headers[key]) this.except("0015", key)
|
|
77
87
|
return headers[key];
|
|
@@ -52,7 +52,7 @@ export default class RepositoryRest<Body=any,Res=any> extends Repository
|
|
|
52
52
|
return call.then(async (res: Response) => {
|
|
53
53
|
let headers: any = {}; res.headers.forEach((value, key) => headers[key] = value);
|
|
54
54
|
let response: HttpResponse<E> = {
|
|
55
|
-
httpCode: res.status,
|
|
55
|
+
httpCode: res.status, content: (await res.json()) as E, headers
|
|
56
56
|
};
|
|
57
57
|
this.options?.onResponse?.(response);
|
|
58
58
|
return response;
|