quidproquo-actionprocessor-node 0.0.22 → 0.0.24
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.
|
@@ -16,6 +16,10 @@ const quidproquo_core_1 = require("quidproquo-core");
|
|
|
16
16
|
const axios_1 = __importDefault(require("axios"));
|
|
17
17
|
const axiosInstance = axios_1.default.create({
|
|
18
18
|
timeout: 10000,
|
|
19
|
+
headers: {
|
|
20
|
+
// Fixes: https://github.com/axios/axios/issues/5346
|
|
21
|
+
'Accept-Encoding': 'gzip,deflate,compress',
|
|
22
|
+
},
|
|
19
23
|
});
|
|
20
24
|
const processNetworkRequestGet = (payload) => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
25
|
const response = yield axiosInstance.get(payload.url, {
|
|
@@ -91,13 +95,19 @@ const processNetworkRequest = (payload) => __awaiter(void 0, void 0, void 0, fun
|
|
|
91
95
|
if (!requestMethod) {
|
|
92
96
|
return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.NotImplemented, `${payload.method}: Not implemented`);
|
|
93
97
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
try {
|
|
99
|
+
const response = yield requestMethod(payload);
|
|
100
|
+
return (0, quidproquo_core_1.actionResult)({
|
|
101
|
+
headers: response.headers,
|
|
102
|
+
status: response.status,
|
|
103
|
+
statusText: response.statusText,
|
|
104
|
+
data: response.data,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
catch (err) {
|
|
108
|
+
console.log(err);
|
|
109
|
+
return (0, quidproquo_core_1.actionResultError)(quidproquo_core_1.ErrorTypeEnum.GenericError, err.stack);
|
|
110
|
+
}
|
|
101
111
|
});
|
|
102
112
|
exports.default = {
|
|
103
113
|
[quidproquo_core_1.NetworkActionType.Request]: processNetworkRequest,
|