[GH-ISSUE #1755] When using the script according to the request, the content of the body will be added and become a string #1748

Open
opened 2026-03-03 19:54:01 +03:00 by kerem · 14 comments
Owner

Originally created by @ThinkerT on GitHub (Aug 25, 2023).
Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1755

Originally assigned to: @NghiaTranUIT on GitHub.

Description

If the body in the request is an encrypted character, when the script uses the on request method, it will automatically add the body to a string, causing the decryption to fail

Similar to 1602 problem steps

The log of proxyman has been sent by email

Steps to Reproduce

2023-08-25-16.49.57.webm

Current Behavior

Expected Behavior

Environment

  • App version: e.g Proxyman 4.9.1
  • macOS version: e.g macOS Ventura
Originally created by @ThinkerT on GitHub (Aug 25, 2023). Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1755 Originally assigned to: @NghiaTranUIT on GitHub. ## Description <!--- Description for the bug? --> If the body in the request is an encrypted character, when the script uses the on request method, it will automatically add the body to a string, causing the decryption to fail Similar to [1602](https://github.com/ProxymanApp/Proxyman/issues/1682) problem steps The log of proxyman has been sent by email ## Steps to Reproduce [2023-08-25-16.49.57.webm](https://github.com/ProxymanApp/Proxyman/assets/15814211/0c1afcbc-d16e-4cc9-8fec-3cce6604011e) ## Current Behavior <!--- What went wrong? --> ## Expected Behavior <!--- What should have happened? --> ## Environment - App version: e.g Proxyman 4.9.1 - macOS version: e.g macOS Ventura
Author
Owner

@NghiaTranUIT commented on GitHub (Sep 3, 2023):

Hi @ThinkerT sorry for the late reply, can you send the log again to support@proxyman.io ? 🤔 I couldn't find your email.

<!-- gh-comment-id:1704278924 --> @NghiaTranUIT commented on GitHub (Sep 3, 2023): Hi @ThinkerT sorry for the late reply, can you send the log again to support@proxyman.io ? 🤔 I couldn't find your email.
Author
Owner

@NghiaTranUIT commented on GitHub (Sep 3, 2023):

@ThinkerT let's try this build: https://download.proxyman.io/beta/Proxyman_4.10.0_fix_primitive_json_on_scripting.dmg

The problem is: Your Request Header is Content-Type: application/json. Thus, it treats your Body as a JSON String.

This Beta fixes the primitive JSON with the Scripting. It works with a String, Int, Float, Boolean, and Null.

<!-- gh-comment-id:1704304851 --> @NghiaTranUIT commented on GitHub (Sep 3, 2023): @ThinkerT let's try this build: https://download.proxyman.io/beta/Proxyman_4.10.0_fix_primitive_json_on_scripting.dmg The problem is: Your Request Header is `Content-Type: application/json`. Thus, it treats your Body as a JSON String. This Beta fixes the primitive JSON with the Scripting. It works with a String, Int, Float, Boolean, and Null.
Author
Owner

@Qnner commented on GitHub (Sep 4, 2023):

@ThinkerT let's try this build: https://download.proxyman.io/beta/Proxyman_4.10.0_fix_primitive_json_on_scripting.dmg

The problem is: Your Request Header is Content-Type: application/json. Thus, it treats your Body as a JSON String.

This Beta fixes the primitive JSON with the Scripting. It works with a String, Int, Float, Boolean, and Null.

this build is not work right. It changed my Body too.

<!-- gh-comment-id:1705169839 --> @Qnner commented on GitHub (Sep 4, 2023): > @ThinkerT let's try this build: https://download.proxyman.io/beta/Proxyman_4.10.0_fix_primitive_json_on_scripting.dmg > > The problem is: Your Request Header is `Content-Type: application/json`. Thus, it treats your Body as a JSON String. > > This Beta fixes the primitive JSON with the Scripting. It works with a String, Int, Float, Boolean, and Null. this build is not work right. It changed my Body too.
Author
Owner

@NghiaTranUIT commented on GitHub (Sep 4, 2023):

Ah, just wondering: What is your Response Body? Is it a JSON String or a String?

<!-- gh-comment-id:1705175782 --> @NghiaTranUIT commented on GitHub (Sep 4, 2023): Ah, just wondering: What is your Response Body? Is it a JSON String or a String?
Author
Owner

@Qnner commented on GitHub (Sep 4, 2023):

Original Request

curl 'https://google.com/test' \ -X POST \ -H 'Host: google.com' \ -H 'x-tt-env: ppe_dev' \ -H 'x-use-ppe: 1' \ -H 'Connection: close' \ -H 'Content-Type: application/json' \ --data-raw '{"4":4,"1":1,"7":777,"5":5,"3":3,"2":2,"6":6}'

script

image

test result

image
image

<!-- gh-comment-id:1705197345 --> @Qnner commented on GitHub (Sep 4, 2023): ## Original Request `curl 'https://google.com/test' \ -X POST \ -H 'Host: google.com' \ -H 'x-tt-env: ppe_dev' \ -H 'x-use-ppe: 1' \ -H 'Connection: close' \ -H 'Content-Type: application/json' \ --data-raw '{"4":4,"1":1,"7":777,"5":5,"3":3,"2":2,"6":6}' ` ## script ![image](https://github.com/ProxymanApp/Proxyman/assets/32847418/caab9a6e-f421-4d69-9716-c0d95e59c001) ## test result ![image](https://github.com/ProxymanApp/Proxyman/assets/32847418/fe89ab21-4b16-4f74-94b9-1caebccabee9) ![image](https://github.com/ProxymanApp/Proxyman/assets/32847418/a6948c8f-c3ce-4973-8f8d-aca751721f35)
Author
Owner

@NghiaTranUIT commented on GitHub (Sep 4, 2023):

Ah I see, it's a known issue. Since Dictionary from Swift isn't an Order-Dictionary, the order of keys is mixed when performing the serialization and deserialization.

Let me think how to fix it 👍

<!-- gh-comment-id:1705220485 --> @NghiaTranUIT commented on GitHub (Sep 4, 2023): Ah I see, it's a known issue. Since Dictionary from Swift isn't an Order-Dictionary, the order of keys is mixed when performing the serialization and deserialization. Let me think how to fix it 👍
Author
Owner

@Qnner commented on GitHub (Sep 27, 2023):

Ah I see, it's a known issue. Since Dictionary from Swift isn't an Order-Dictionary, the order of keys is mixed when performing the serialization and deserialization.

Let me think how to fix it 👍

Is there any update for this issue?

<!-- gh-comment-id:1736767188 --> @Qnner commented on GitHub (Sep 27, 2023): > Ah I see, it's a known issue. Since Dictionary from Swift isn't an Order-Dictionary, the order of keys is mixed when performing the serialization and deserialization. > > Let me think how to fix it 👍 Is there any update for this issue?
Author
Owner

@ThinkerT commented on GitHub (Oct 8, 2023):

@ThinkerT let's try this build: https://download.proxyman.io/beta/Proxyman_4.10.0_fix_primitive_json_on_scripting.dmg

The problem is: Your Request Header is Content-Type: application/json. Thus, it treats your Body as a JSON String.

This Beta fixes the primitive JSON with the Scripting. It works with a String, Int, Float, Boolean, and Null.

Hello, is this fix not updated in the latest version? I don’t see the 4.12.0 version.

<!-- gh-comment-id:1751945507 --> @ThinkerT commented on GitHub (Oct 8, 2023): > @ThinkerT let's try this build: https://download.proxyman.io/beta/Proxyman_4.10.0_fix_primitive_json_on_scripting.dmg > > The problem is: Your Request Header is `Content-Type: application/json`. Thus, it treats your Body as a JSON String. > > This Beta fixes the primitive JSON with the Scripting. It works with a String, Int, Float, Boolean, and Null. Hello, is this fix not updated in the latest version? I don’t see the 4.12.0 version.
Author
Owner

@NghiaTranUIT commented on GitHub (Oct 8, 2023):

@ThinkerT It's fixed on the latest version 4.12.0. Can you give it a try?

<!-- gh-comment-id:1751946015 --> @NghiaTranUIT commented on GitHub (Oct 8, 2023): @ThinkerT It's fixed on the latest version 4.12.0. Can you give it a try?
Author
Owner

@ThinkerT commented on GitHub (Oct 8, 2023):

@ThinkerT It's fixed on the latest version 4.12.0. Can you give it a try?

After update 4.12.0, it seems to be fixed, thank you very much 👍

<!-- gh-comment-id:1751968119 --> @ThinkerT commented on GitHub (Oct 8, 2023): > @ThinkerT It's fixed on the latest version 4.12.0. Can you give it a try? After update 4.12.0, it seems to be fixed, thank you very much 👍
Author
Owner

@Qnner commented on GitHub (Jan 17, 2024):

@NghiaTranUIT
this issue come again!
version: macOS Version 4.16.0 (49700)

image

image

<!-- gh-comment-id:1895156720 --> @Qnner commented on GitHub (Jan 17, 2024): @NghiaTranUIT this issue come again! version: macOS Version 4.16.0 (49700) ![image](https://github.com/ProxymanApp/Proxyman/assets/32847418/b74c8c09-01ea-46a9-8d84-6e94c73fa878) ![image](https://github.com/ProxymanApp/Proxyman/assets/32847418/e6b061a0-1559-49c3-9ffd-a189c6fe4383)
Author
Owner

@NghiaTranUIT commented on GitHub (Jan 17, 2024):

@Qnner your problem is a different problem. In general, the order of the keys in the JSON isn't preserved. It's the nature of NSDictionary when converting JSObject (JS) to Swift. I don't have a solution to fix it.

<!-- gh-comment-id:1895174042 --> @NghiaTranUIT commented on GitHub (Jan 17, 2024): @Qnner your problem is a different problem. In general, the order of the keys in the JSON isn't preserved. It's the nature of NSDictionary when converting JSObject (JS) to Swift. I don't have a solution to fix it.
Author
Owner

@Qnner commented on GitHub (Jan 17, 2024):

@Qnner your problem is a different problem. In general, the order of the keys in the JSON isn't preserved. It's the nature of NSDictionary when converting JSObject (JS) to Swift. I don't have a solution to fix it.

Is there any advice for my question?
My request will add a encrypted header by req.body string. How can I keep req.body keep original? And I need use 'Scripting' function

<!-- gh-comment-id:1895183147 --> @Qnner commented on GitHub (Jan 17, 2024): > @Qnner your problem is a different problem. In general, the order of the keys in the JSON isn't preserved. It's the nature of NSDictionary when converting JSObject (JS) to Swift. I don't have a solution to fix it. Is there any advice for my question? My request will add a encrypted header by req.body string. How can I keep req.body keep original? And I need use 'Scripting' function
Author
Owner

@NghiaTranUIT commented on GitHub (Jan 18, 2024):

Sorry, I don't have any possible solution for the Dictionary key-order issue. Can you use the Breakpoint on Request to modify it ?

<!-- gh-comment-id:1898001720 --> @NghiaTranUIT commented on GitHub (Jan 18, 2024): Sorry, I don't have any possible solution for the Dictionary key-order issue. Can you use the Breakpoint on Request to modify it ?
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#1748
No description provided.