@itentialopensource/adapter-utils 4.48.8 → 4.48.9
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/CHANGELOG.md +10 -0
- package/lib/restHandler.js +13 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/lib/restHandler.js
CHANGED
|
@@ -22,7 +22,7 @@ let globalRequestGl = null;
|
|
|
22
22
|
let returnRawGl = false;
|
|
23
23
|
let encodePath = true;
|
|
24
24
|
let encodeUri = true;
|
|
25
|
-
|
|
25
|
+
let stripEscapes = false;
|
|
26
26
|
// INTERNAL FUNCTIONS
|
|
27
27
|
/*
|
|
28
28
|
* INTERNAL FUNCTION: Get the best match for the mock data response
|
|
@@ -967,7 +967,13 @@ function buildPayload(entity, action, entitySchema, payload) {
|
|
|
967
967
|
return '';
|
|
968
968
|
}
|
|
969
969
|
}
|
|
970
|
-
|
|
970
|
+
// strip escapes if payload is double escaped
|
|
971
|
+
if (stripEscapes && systemEntity) {
|
|
972
|
+
let newPayload = JSON.stringify(systemEntity);
|
|
973
|
+
newPayload = newPayload.replace(/\\\\/g, '\\');
|
|
974
|
+
log.debug(`STRIPPED BODY HERE: ${newPayload}`);
|
|
975
|
+
return newPayload;
|
|
976
|
+
}
|
|
971
977
|
// return the payload
|
|
972
978
|
return JSON.stringify(systemEntity);
|
|
973
979
|
} catch (e) {
|
|
@@ -1021,6 +1027,11 @@ class RestHandler {
|
|
|
1021
1027
|
this.encodeQ = properties.encode_queryvars;
|
|
1022
1028
|
encodeUri = this.encodeQ;
|
|
1023
1029
|
|
|
1030
|
+
// optional to strip extra escapes - default is false
|
|
1031
|
+
if (properties.stripEscapes) {
|
|
1032
|
+
stripEscapes = properties.stripEscapes;
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1024
1035
|
// only need to set returnRaw if the property is true - defaults to false
|
|
1025
1036
|
if (properties.request && properties.request.return_raw) {
|
|
1026
1037
|
returnRawGl = properties.request.return_raw;
|