Proxyman icon indicating copy to clipboard operation
Proxyman copied to clipboard

Scripting - differences between Mac and Windows

Open wabiloo opened this issue 8 months ago • 0 comments

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

wabiloo avatar Apr 30 '25 15:04 wabiloo