[GH-ISSUE #1532] Map local - request/response. Add feature to modify only some values/objects #1525

Open
opened 2026-03-03 19:52:11 +03:00 by kerem · 3 comments
Owner

Originally created by @almaz010891 on GitHub (Feb 9, 2023).
Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1532

Description

I am QA engeneer. For example, I really often need to recieve fresh data from some specific request during app testing, but modify only one/some parameters each time calling this specific API(e.g. "showbutton": "false" --> "showbutton": "true").

Cases for mocking:

  • Array: change elements count (Non-empty array --> empty array, 8 items --> 7 items, 1 item --> 100 items)
  • Array: remove array with key from JSON, add array
  • Strings/Int/boolean e.g: add/remove/modify values
  • Raw response: add/replace/remove substring from raw response

Why this feature/change is important?

Because now i can't automatically change only one/some parameters with some UI functionality, but if you are QA engeneer you often need to edit each specific API call response manually via breakpoint - it's need a lot of time for this routine action. Postman app has this functionality and for me it's a killer feature. Would be nice if you add this feature in Proxyman.

Originally created by @almaz010891 on GitHub (Feb 9, 2023). Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1532 ## Description I am QA engeneer. For example, I really often need to recieve fresh data from some specific request during app testing, but modify only one/some parameters each time calling this specific API(e.g. "showbutton": "false" --> "showbutton": "true"). Cases for mocking: - Array: change elements count (Non-empty array --> empty array, 8 items --> 7 items, 1 item --> 100 items) - Array: remove array with key from JSON, add array - Strings/Int/boolean e.g: add/remove/modify values - Raw response: add/replace/remove substring from raw response ## Why this feature/change is important? Because now i can't automatically change only one/some parameters with some UI functionality, but if you are QA engeneer you often need to edit each specific API call response manually via breakpoint - it's need a lot of time for this routine action. Postman app has this functionality and for me it's a killer feature. Would be nice if you add this feature in Proxyman.
Author
Owner

@NghiaTranUIT commented on GitHub (Feb 9, 2023):

Postman app has this functionality and for me it's a killer feature.

Can you show me the link?


For complicated cases, I suggest using the Scripting Tool.

Here is a sample how to modify the Response Body.

async function onResponse(context, url, request, response) {
  // console.log(response);

  // Update or Add new headers
  response.headers["Content-Type"] = "application/json";

  // Update status Code
  response.statusCode = 500;

 // Update Body
 var body = response.body;
body["new-key"] = "Proxyman";
response.body = body;

  // Or map a local file as a body
  // response.bodyFilePath = "~/Desktop/myfile.json"

  // Done
  return response;
}

More snippet code at https://docs.proxyman.io/scripting/snippet-code#json-body

<!-- gh-comment-id:1423896723 --> @NghiaTranUIT commented on GitHub (Feb 9, 2023): > Postman app has this functionality and for me it's a killer feature. Can you show me the link? -------------- For complicated cases, I suggest using the Scripting Tool. Here is a sample how to modify the Response Body. ```js async function onResponse(context, url, request, response) { // console.log(response); // Update or Add new headers response.headers["Content-Type"] = "application/json"; // Update status Code response.statusCode = 500; // Update Body var body = response.body; body["new-key"] = "Proxyman"; response.body = body; // Or map a local file as a body // response.bodyFilePath = "~/Desktop/myfile.json" // Done return response; } ``` More snippet code at https://docs.proxyman.io/scripting/snippet-code#json-body
Author
Owner

@almaz010891 commented on GitHub (Feb 9, 2023):

Postman app has this functionality and for me it's a killer feature.

Can you show me the link?

Sorry, I meant Charles proxy :)
Link - Rewriting traffic with the Rewrite tool

You can use this realization as example. It's better to have UI for this functionality instead of Scripting

<!-- gh-comment-id:1423911739 --> @almaz010891 commented on GitHub (Feb 9, 2023): > > Postman app has this functionality and for me it's a killer feature. > > Can you show me the link? Sorry, I meant Charles proxy :) [Link](https://deliveroo.engineering/2018/12/04/how-to-use-charles-proxy-to-rewrite-https-traffic-for-web-applications.html ) - **Rewriting traffic with the Rewrite tool** You can use this realization as example. It's better to have UI for this functionality instead of Scripting
Author
Owner

@NghiaTranUIT commented on GitHub (Feb 9, 2023):

Thanks. Scripting is designed as a better replacement of the Rewrite.

You can express what you want by using simple JS code.

On the other hand, ReWrite GUI is so complicated if you have a lot of if statement.

<!-- gh-comment-id:1423914300 --> @NghiaTranUIT commented on GitHub (Feb 9, 2023): Thanks. Scripting is designed as a better replacement of the Rewrite. You can express what you want by using simple JS code. On the other hand, ReWrite GUI is so complicated if you have a lot of `if statement`.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Proxyman#1525
No description provided.