@requestly/requestly-proxy 1.1.14 → 1.1.16

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.
@@ -15,9 +15,11 @@ class AmisuingMiddleware {
15
15
  if (!this.is_active) {
16
16
  return true;
17
17
  }
18
- Object.assign(ctx.proxyToServerRequestOptions.headers, {
19
- ["amiusingrequestly"]: "true",
20
- });
18
+ if (ctx.proxyToServerRequestOptions.host === "amiusing.requestly.io") {
19
+ Object.assign(ctx.proxyToServerRequestOptions.headers, {
20
+ ["amiusingrequestly"]: "true",
21
+ });
22
+ }
21
23
  });
22
24
  this.is_active = is_active;
23
25
  }
@@ -17,6 +17,7 @@ const requestly_core_1 = require("@requestly/requestly-core");
17
17
  const proxy_ctx_helper_1 = require("../../helpers/proxy_ctx_helper");
18
18
  const utils_1 = require("../utils");
19
19
  const capture_console_logs_1 = __importDefault(require("capture-console-logs"));
20
+ const utils_2 = require("../../../../utils");
20
21
  const { types } = require("util");
21
22
  const process_modify_request_action = (action, ctx) => {
22
23
  const allowed_handlers = [proxy_1.PROXY_HANDLER_TYPE.ON_REQUEST_END];
@@ -40,7 +41,7 @@ const modify_request = (ctx, new_req) => {
40
41
  const modify_request_using_code = (action, ctx) => __awaiter(void 0, void 0, void 0, function* () {
41
42
  let userFunction = null;
42
43
  try {
43
- userFunction = requestly_core_1.UTILS.GET_FUNCTION_FROM_STRING(action.request);
44
+ userFunction = (0, utils_2.getFunctionFromString)(action.request);
44
45
  }
45
46
  catch (error) {
46
47
  // User has provided an invalid function
@@ -19,6 +19,7 @@ const utils_1 = require("../utils");
19
19
  const fs_1 = __importDefault(require("fs"));
20
20
  const http_helpers_1 = require("../../helpers/http_helpers");
21
21
  const capture_console_logs_1 = __importDefault(require("capture-console-logs"));
22
+ const utils_2 = require("../../../../utils");
22
23
  const { types } = require("util");
23
24
  const process_modify_response_action = (action, ctx) => __awaiter(void 0, void 0, void 0, function* () {
24
25
  const allowed_handlers = [proxy_1.PROXY_HANDLER_TYPE.ON_RESPONSE_END];
@@ -57,7 +58,7 @@ const modify_response_using_code = (action, ctx) => __awaiter(void 0, void 0, vo
57
58
  var _a, _b;
58
59
  let userFunction = null;
59
60
  try {
60
- userFunction = requestly_core_1.UTILS.GET_FUNCTION_FROM_STRING(action.response);
61
+ userFunction = (0, utils_2.getFunctionFromString)(action.response);
61
62
  }
62
63
  catch (error) {
63
64
  // User has provided an invalid function
@@ -0,0 +1 @@
1
+ export declare const getFunctionFromString: (functionStringEscaped: any) => any;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getFunctionFromString = void 0;
4
+ const getFunctionFromString = function (functionStringEscaped) {
5
+ return new Function("return " + functionStringEscaped)();
6
+ };
7
+ exports.getFunctionFromString = getFunctionFromString;
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@requestly/requestly-proxy",
3
- "version": "1.1.14",
3
+ "version": "1.1.16",
4
4
  "description": "Proxy that gives superpowers to all the Requestly clients",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1",
8
8
  "dev": "nodemon src/test.ts",
9
- "build": "tsc"
9
+ "build": "tsc",
10
+ "watch": "tsc --watch"
10
11
  },
11
12
  "repository": {
12
13
  "type": "git",