ProxymanApp / ProxymanApp/Proxyman

[Scripting] The `response.rawBody` property does not preserve the original request body payload

Open
#1,699 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
No language data
Stars
7k
Forks
237
PR merge metrics
No merged PRs in 30d

Description

Description

I just spotted an issue when I needed to amend the response with a dynamically modified property and calculated signature on the client side (Proxyman). As a result, it has turned out that the response.rawBody property does not guarantee its contents to be exactly the same as the body response payload, which resulted in being unable to calculate the proper signature (the raw response body was different in the script and in the client app).

Steps to Reproduce

  1. Add the following snippet for scripting for any of the endpoints:
async function onResponse(context, url, request, response) {
  console.log("\n" + response.rawBody);
  return response;
}
  1. Perform any request that runs the script.
  2. Observe the logs, compare the request body and the console logs.

Current Behavior

The logged body contents differ from the ones in the response body.

Expected Behavior

The logged body contents should be the same as the ones in the response body in the Proxyman window.

Environment

  • App version: e.g Proxyman 4.8.1
  • macOS version: e.g macOS Ventura 13.4.1 (22F82)

Please tell me if you need more support by reproducing the issue, or if I can help in some other way.

Cheers!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the scripting implementation of response.rawBody and reproduce the issue with the onResponse snippet from the report. Done means the value exposed to scripts preserves the response body exactly as shown in the Proxyman window; no source files or tests are named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.