mirror of
https://github.com/ProxymanApp/Proxyman.git
synced 2026-04-27 17:15:49 +03:00
[GH-ISSUE #1699] [Scripting] The response.rawBody property does not preserve the original request body payload #1691
Labels
No labels
Discussion
Feature request
In Progress...
Plugins
Waiting response
Windows
Windows
bug
duplicate
enhancement
feature
good first issue
iOS
macOS 10.11
question
wontfix
✅ Done
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/Proxyman#1691
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @hkosacki on GitHub (Jun 30, 2023).
Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1699
Description
I just spotted an issue when I needed to amend the response with a dynamically modified property and calculated signature on the client side (Proxyman). As a result, it has turned out that the
response.rawBodyproperty does not guarantee its contents to be exactly the same as the body response payload, which resulted in being unable to calculate the proper signature (the raw response body was different in the script and in the client app).Steps to Reproduce
Current Behavior
The logged body contents differ from the ones in the response body.
Expected Behavior
The logged body contents should be the same as the ones in the response body in the Proxyman window.
Environment
Please tell me if you need more support by reproducing the issue, or if I can help in some other way.
Cheers!
@hkosacki commented on GitHub (Jun 30, 2023):
Please find the screenshot attached:

@NghiaTranUIT commented on GitHub (Jun 30, 2023):
I'd say that it's the expected behavior of the Scripting.
Proxyman passes the Dictionary (Body) to the Script (JavascriptCore), and converts the Dictionary back to the Swift. By default, Dictionary doesn't respect the key order, so the issue happens.
@hkosacki the key order is different, but the Dictionary is the same.
@hkosacki commented on GitHub (Jul 3, 2023):
I see your point. But this kind of behaviour I find desired if we are talking about the parsed body structure under the
response.bodyproperty, since there the order of the items indeed does not matter.But then, regarding
rawBodyproperty, I'd say that its name is actually misleading if there is no way to guarantee the original payload here.The documentation claims the following:
rawBody": "<Readonly>: A raw body String or Base64 encoded string if it's a binary",As the user, I'd expect from the
raw body Stringto be exactly the same as it could be seen in the response lookup view.This unfortunately doesn't allow me to perform any calculation on mocked/modified responses in terms of providing its SHA1 hash etc., since I have no guarantee to receive the same payload in my client app.