ProxymanApp / ProxymanApp/Proxyman

Scripting - differences between Mac and Windows

Open
#2,335 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

I have a onResponse() function in a script that works very well on mac.
The outline of it is:

async function onResponse(context, url, request, response) {
  var body = response.body;
  console.log(body)
  response.body = manipulate(body)
  return response
}

On Mac, the body is just what I expect (it's fundamentally a text format)

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-INDEPENDENT-SEGMENTS
...

On Windows however, the body seems to be a JSON object. When I log it, the console shows something like this:

[16:39:53.306]: onResponse) is executed with
Flow ID = 825
16:39:53.306 onResponse) is executed!
{"type": "Buffer",
"data": [
35,
69,
88,
84,
77,
51,
85.
10,
35.
69,
...
]}

Is that normal? Is there a simple way to avoid this type of difference and having scripts that will work on both OS?

In case it's relevant, the response headers are fundamentally the same.

Note: the Response > Body panel is showing the correct text data. The issue is only within the script

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 with the onResponse(context, url, request, response) script and compare response.body on macOS and Windows, using the Response > Body panel as the reference. Confirm whether Windows exposes a Buffer-shaped object while macOS exposes text, then verify that a consistent body representation allows manipulate(body) to work on both operating systems.

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.