@requestly/requestly-proxy 1.3.10 → 1.3.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.
@@ -146,6 +146,7 @@ class ProxyMiddlewareManager {
146
146
  let pre_final_body = parsedBody || body.toString("utf8");
147
147
  ctx.rq.set_original_request({ body: pre_final_body });
148
148
  ctx.rq_request_body = pre_final_body;
149
+ let request_rule_applied = false;
149
150
  if (parsedBody && constants_1.RQ_INTERCEPTED_CONTENT_TYPES.includes(contentType)) {
150
151
  // Do modifications, if any
151
152
  const { action_result_objs, continue_request } = await rules_middleware.on_request_end(ctx);
@@ -153,9 +154,15 @@ class ProxyMiddlewareManager {
153
154
  logger_middleware.send_network_log(ctx, rules_middleware.action_result_objs, requestly_core_1.CONSTANTS.REQUEST_STATE.COMPLETE);
154
155
  return;
155
156
  }
157
+ request_rule_applied = action_result_objs === null || action_result_objs === void 0 ? void 0 : action_result_objs.some((obj) => { var _a; return ((_a = obj === null || obj === void 0 ? void 0 : obj.action) === null || _a === void 0 ? void 0 : _a.action) === constants_1.RULE_ACTION.MODIFY_REQUEST; });
158
+ }
159
+ if (request_rule_applied) {
160
+ ctx.proxyToServerRequest.write(ctx.rq_request_body);
161
+ }
162
+ else {
163
+ // If no modifications, write the original request body buffer so that we don't mess up during decoding
164
+ ctx.proxyToServerRequest.write(body);
156
165
  }
157
- // Use the updated request
158
- ctx.proxyToServerRequest.write(ctx.rq_request_body);
159
166
  ctx.rq.set_final_request({ body: ctx.rq_request_body });
160
167
  return callback();
161
168
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@requestly/requestly-proxy",
3
- "version": "1.3.10",
3
+ "version": "1.3.11",
4
4
  "description": "Proxy that gives superpowers to all the Requestly clients",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -26,7 +26,7 @@
26
26
  "author": "",
27
27
  "license": "ISC",
28
28
  "dependencies": {
29
- "@requestly/requestly-core": "^1.1.0",
29
+ "@requestly/requestly-core": "1.1.1",
30
30
  "@sentry/browser": "^8.33.1",
31
31
  "async": "^3.2.5",
32
32
  "axios": "^1.7.2",