@shushed/helpers 0.0.198-v2-20251110171602 → 0.0.198-v2-20251111082635
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.
|
@@ -269,29 +269,28 @@ function onResponse(config, options, requiredFlag) {
|
|
|
269
269
|
return;
|
|
270
270
|
}
|
|
271
271
|
let responsePayload;
|
|
272
|
-
if (outputBody
|
|
273
|
-
responsePayload = outputBody.
|
|
274
|
-
headersToSet = outputBody.headersToSet;
|
|
272
|
+
if (outputBody?.headersToSet && outputBody?.responses) {
|
|
273
|
+
responsePayload = outputBody.responses;
|
|
275
274
|
}
|
|
276
275
|
else {
|
|
277
276
|
responsePayload = outputBody;
|
|
278
277
|
}
|
|
279
|
-
if (Array.isArray(responsePayload) && responsePayload.length === numberOfInputMessages) {
|
|
278
|
+
if (responsePayload && Array.isArray(responsePayload) && responsePayload.length === numberOfInputMessages) {
|
|
280
279
|
return {
|
|
281
|
-
status:
|
|
280
|
+
status: headersToSet['retry-after'] ? 429 : (outputStatus ? outputStatus : ((responsePayload && responsePayload instanceof Error) ? 500 : 200)),
|
|
282
281
|
value: responsePayload.map(x => {
|
|
283
|
-
if (x.
|
|
282
|
+
if (x && typeof x === 'object' && x.statusCode && x.body) {
|
|
284
283
|
return x;
|
|
285
284
|
}
|
|
286
285
|
return {
|
|
287
|
-
|
|
288
|
-
body: x instanceof Error ? x.message :
|
|
286
|
+
statusCode: x instanceof Error ? (headersToSet['retry-after'] ? 429 : 500) : 200,
|
|
287
|
+
body: x instanceof Error ? x.message : x,
|
|
289
288
|
};
|
|
290
289
|
})
|
|
291
290
|
};
|
|
292
291
|
}
|
|
293
292
|
return {
|
|
294
|
-
status: headersToSet['retry-after'] ? 429 : (outputStatus ? outputStatus : (responsePayload instanceof Error ? 500 : 200)),
|
|
293
|
+
status: headersToSet['retry-after'] ? 429 : (outputStatus ? outputStatus : ((responsePayload && responsePayload instanceof Error) ? 500 : 200)),
|
|
295
294
|
value: responsePayload,
|
|
296
295
|
cacheMaxAge: 0,
|
|
297
296
|
};
|