@requestly/requestly-proxy 1.1.4 → 1.1.5

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,7 @@ exports.RQ_INTERCEPTED_CONTENT_TYPES = [
16
16
  "text/plain",
17
17
  "text/javascript",
18
18
  "application/javascript",
19
+ "application/x-javascript",
19
20
  "text/css",
20
21
  "application/css",
21
22
  "application/json",
@@ -90,7 +90,7 @@ class RuleActionProcessor {
90
90
  action_result = (0, modify_request_processor_1.default)(rule_action, ctx);
91
91
  break;
92
92
  case constants_1.RULE_ACTION.MODIFY_RESPONSE:
93
- action_result = (0, modify_response_processor_1.default)(rule_action, ctx);
93
+ action_result = yield (0, modify_response_processor_1.default)(rule_action, ctx);
94
94
  break;
95
95
  case constants_1.RULE_ACTION.INSERT:
96
96
  action_result = (0, insert_processor_1.default)(rule_action, ctx);
@@ -1,6 +1,6 @@
1
1
  export default process_modify_response_action;
2
- declare function process_modify_response_action(action: any, ctx: any): {
2
+ declare function process_modify_response_action(action: any, ctx: any): Promise<{
3
3
  action: any;
4
4
  success: boolean;
5
5
  post_process_data: any;
6
- };
6
+ }>;
@@ -18,14 +18,14 @@ const proxy_ctx_helper_1 = require("../../helpers/proxy_ctx_helper");
18
18
  const utils_1 = require("../utils");
19
19
  const fs_1 = __importDefault(require("fs"));
20
20
  const { types } = require("util");
21
- const process_modify_response_action = (action, ctx) => {
21
+ const process_modify_response_action = (action, ctx) => __awaiter(void 0, void 0, void 0, function* () {
22
22
  const allowed_handlers = [proxy_1.PROXY_HANDLER_TYPE.ON_RESPONSE_END];
23
23
  if (!allowed_handlers.includes(ctx.currentHandler)) {
24
24
  return (0, utils_1.build_action_processor_response)(action, false);
25
25
  }
26
26
  if (action.responseType &&
27
27
  action.responseType === requestly_core_1.CONSTANTS.RESPONSE_BODY_TYPES.CODE) {
28
- modify_response_using_code(action, ctx);
28
+ yield modify_response_using_code(action, ctx);
29
29
  return (0, utils_1.build_action_processor_response)(action, true);
30
30
  }
31
31
  else if (action.responseType === requestly_core_1.CONSTANTS.RESPONSE_BODY_TYPES.LOCAL_FILE) {
@@ -36,7 +36,7 @@ const process_modify_response_action = (action, ctx) => {
36
36
  modify_response(ctx, action.response, action.statusCode);
37
37
  return (0, utils_1.build_action_processor_response)(action, true);
38
38
  }
39
- };
39
+ });
40
40
  const modify_response = (ctx, new_resp, status_code) => {
41
41
  ctx.rq_response_body = new_resp;
42
42
  ctx.rq_response_status_code = status_code;
@@ -90,8 +90,7 @@ const modify_response_using_code = (action, ctx) => __awaiter(void 0, void 0, vo
90
90
  if (types.isPromise(finalResponse)) {
91
91
  finalResponse = yield finalResponse;
92
92
  }
93
- const isResponseJSON = args.responseType && args.responseType.includes("application/json");
94
- if (typeof finalResponse === "object" && isResponseJSON) {
93
+ if (typeof finalResponse === "object") {
95
94
  finalResponse = JSON.stringify(finalResponse);
96
95
  }
97
96
  if (finalResponse && typeof finalResponse === "string") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@requestly/requestly-proxy",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": "Proxy that gives superpowers to all the Requestly clients",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {