[GH-ISSUE #1261] Integer values become float ones by using scripting #1256

Closed
opened 2026-03-03 19:49:45 +03:00 by kerem · 3 comments
Owner

Originally created by @torokdnl on GitHub (Jun 23, 2022).
Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1261

Originally assigned to: @NghiaTranUIT on GitHub.

Proxyman version? (Ex. Proxyman 1.4.3)

Proxyman Version 3.6.0 (30600)

macOS Version? (Ex. mac 10.14)

macOS Monterey 12.3.1 (21E258)
macOS Monterey 12.4 (21F79)

Steps to reproduce

  1. Turn on scripting (in my case it's a simple if-else what colors the request/responses)
  2. Get your request with the original integer value (in my case it's a "randomTimestamp")

Original value: 1655989280365

I can see this value in the following requests like this:

  • Without the scripting: 1655989280365
  • With the scripting: 1655991846719.0002

Expected behavior

The original value should be kept until the script modifies it (or the tester manually overwrites it).

Originally created by @torokdnl on GitHub (Jun 23, 2022). Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1261 Originally assigned to: @NghiaTranUIT on GitHub. ### Proxyman version? (Ex. Proxyman 1.4.3) Proxyman Version 3.6.0 (30600) ### macOS Version? (Ex. mac 10.14) macOS Monterey 12.3.1 (21E258) macOS Monterey 12.4 (21F79) ### Steps to reproduce 1. Turn on scripting (in my case it's a simple if-else what colors the request/responses) 2. Get your request with the original integer value (in my case it's a "randomTimestamp") Original value: 1655989280365 I can see this value in the following requests like this: - Without the scripting: 1655989280365 - With the scripting: 1655991846719.0002 ### Expected behavior The original value should be kept until the script modifies it (or the tester manually overwrites it).
kerem 2026-03-03 19:49:45 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@NghiaTranUIT commented on GitHub (Jun 23, 2022):

Look like it's a different issue, when passing this big int to JavascriptCore, it might be converted improperly.

I will check it out 👍

<!-- gh-comment-id:1164445498 --> @NghiaTranUIT commented on GitHub (Jun 23, 2022): Look like it's a different issue, when passing this big int to JavascriptCore, it might be converted improperly. I will check it out 👍
Author
Owner

@NghiaTranUIT commented on GitHub (Jun 24, 2022):

@torokdnl please try this beta build: https://proxyman.s3.us-east-2.amazonaws.com/beta/Proxyman_3.6.0_Fix_scripting_with_big_number.dmg

I redesign the algorithm to make sure it maintains request/response JSON. It works will for big number or float/double too 👍

If you're curious what causes the bug behind the scenes. It's because the JSONSerialization.data(withJSONObject::) poorly convert these NSNumber to String. Thus:

  • 2.02 -> 0.0199999
  • 1655989280365 -> 1655991846719.0002
<!-- gh-comment-id:1165296360 --> @NghiaTranUIT commented on GitHub (Jun 24, 2022): @torokdnl please try this beta build: https://proxyman.s3.us-east-2.amazonaws.com/beta/Proxyman_3.6.0_Fix_scripting_with_big_number.dmg I redesign the algorithm to make sure it maintains request/response JSON. It works will for big number or float/double too 👍 If you're curious what causes the bug behind the scenes. It's because the [JSONSerialization.data(withJSONObject::)](https://developer.apple.com/documentation/foundation/jsonserialization/1413636-data) poorly convert these NSNumber to String. Thus: - 2.02 -> 0.0199999 - 1655989280365 -> 1655991846719.0002
Author
Owner

@torokdnl commented on GitHub (Jun 24, 2022):

@NghiaTranUIT -

The build is working correctly, integers remain integers. Thanks a lot for fixing it quickly and for the explanation as well!

<!-- gh-comment-id:1165324243 --> @torokdnl commented on GitHub (Jun 24, 2022): @NghiaTranUIT - The build is working correctly, integers remain integers. Thanks a lot for fixing it quickly and for the explanation as well!
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#1256
No description provided.