ProxymanApp / Proxyman

Modern. Native. Delightful Web Debugging Proxy for macOS, iOS, and Android ⚡️
https://proxyman.io
5.36k stars 177 forks source link

JSON float number values become incorrect after scripting #1258

Open VolodymyrPavlyshenOnseo opened 2 years ago

VolodymyrPavlyshenOnseo commented 2 years ago

Version 3.5.2 (30520)

macOS12.4 (21F79)

  1. Apply request scripting for any json request (for example add new header parameter)
  2. After scripting number values in request sometimes become broken (for example double value "somevalue":0.050 become "somevalue":0.050000000000000003)

Expected:After script apply values should stay the same as it was before, seems like after serialising this floats to js object and back they become broken.

NghiaTranUIT commented 2 years ago

@VolodymyrPavlyshenOnseo please try this beta build: https://proxyman.s3.us-east-2.amazonaws.com/beta/Proxyman_3.5.2_Fix_scripting_issue_with_float_number.dmg

Basically, JSONSerialization.data() doesn't properly parse the float number.

Screenshots

Screen_Shot_2022-06-21_at_16_12_39

VolodymyrPavlyshenOnseo commented 2 years ago

looks good in beta build, thx

torokdnl commented 2 years ago

@NghiaTranUIT - I think I have a similar issue that is not fixed in 3.6.0.

If I do not have any scrip on then I can see this in the request: "randomTimestamp": 1655991482

If I turn the scripting on then I can see this in the request: "randomTimestamp": 1655991522.0000002

Additional data:

Anyway, I've just opened a new issue four our behavior: https://github.com/ProxymanApp/Proxyman/issues/1261

NghiaTranUIT commented 2 years ago

@torokdnl @VolodymyrPavlyshenOnseo Let check this build: https://github.com/ProxymanApp/Proxyman/issues/1261#issuecomment-1165296360