@tiledesk/tiledesk-tybot-connector 2.1.10 → 2.1.11
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
CHANGED
|
@@ -7,7 +7,7 @@ available on:
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
# this branch
|
|
10
|
-
- added:
|
|
10
|
+
- added: Web Request V2 — support for `bodyType: 'raw'` with `rawType` `'text' | 'javascript' | 'json' | 'html' | 'xml'` (raw string body sent verbatim with the Content-Type set in headers; `'json'` keeps the legacy parse/falseIntent semantics); existing `'json'`, `'form-data'` and `'none'` body types unchanged
|
|
11
11
|
|
|
12
12
|
# 2.1.0
|
|
13
13
|
- added: support to analytics
|
package/package.json
CHANGED
|
@@ -223,6 +223,28 @@ class DirWebRequestV2 {
|
|
|
223
223
|
reject("Error parsing formData");
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
|
+
else if (action.bodyType == "raw") {
|
|
227
|
+
const rawType = action.rawType || "json";
|
|
228
|
+
if (!action.jsonBody) {
|
|
229
|
+
resolve(null);
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
let rawBody = filler.fill(action.jsonBody, requestAttributes);
|
|
233
|
+
if (rawType === "json") {
|
|
234
|
+
try {
|
|
235
|
+
let json = JSON.parse(rawBody);
|
|
236
|
+
resolve(json);
|
|
237
|
+
}
|
|
238
|
+
catch (err) {
|
|
239
|
+
winston.error("DirWebRequestV2 Error parsing webRequest raw jsonBody: " + JSON.stringify(rawBody) + "\nError: " + JSON.stringify(err));
|
|
240
|
+
reject("Error parsing jsonBody");
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
// text | xml | html | javascript: raw string sent as-is, Content-Type comes from headers
|
|
245
|
+
resolve(rawBody);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
226
248
|
else {
|
|
227
249
|
resolve(null);
|
|
228
250
|
}
|