mirror of
https://github.com/ProxymanApp/Proxyman.git
synced 2026-04-26 00:25:56 +03:00
[GH-ISSUE #1898] Scripting does not preserve binary payload #1891
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#1891
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 @baotrung-pham-20230331 on GitHub (Jan 2, 2024).
Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1898
Description
If "Content-Type: image/jpeg" is missing from the request header, scripting function seems to assume "Content-Type: application/x-www-form-urlencoded" and convert the binary payload to base64.
I suppose this is somewhat expected, given that the client should have included the correct "Content-Type" header, but sometimes its difficult for me to control this with our current client-side solution. It'd be nice if the Scripting feature does not make any assumption and send the request as-is.
Steps to Reproduce
Current Behavior
payload becomes b64 encoded string

binary payload is preserved

Environment
@NghiaTranUIT commented on GitHub (Jan 2, 2024):
@baotrung-pham-20230331 I'm not sure why you do this:
It means you try to set the rawBody (base64) to the body, so you get the Base64 String in the Request Body. It's intended.
Remove this line, the image body will be preserved.
@baotrung-pham-20230331 commented on GitHub (Jan 2, 2024):
if i remove it, the body becomes empty.
also, if i add "Content-type: image/jpeg" to the request headers, the binary payload is preserved, with or without
request.body = request.rawBody;@NghiaTranUIT commented on GitHub (Jan 2, 2024):
It's hard to fix because the Content-Type indicates it's a
application/x-www-form-urlencoded. So Proxyman tries to parse your Image as a form data -> Lead to incorrect data.You can fix it by overriding the Content-Type
@baotrung-pham-20230331 commented on GitHub (Jan 2, 2024):
Thanks for the prompt reply :)
Yes, I suppose that would work.
However, I never actually add any Content-Type header in this request. The
application/x-www-form-urlencodedwas somehow assumed by the Scripting feature@NghiaTranUIT commented on GitHub (Jan 2, 2024):
It's from
cURL. I disable the Scripting tool and run your cURL command. Theapplication/x-www-form-urlencodedheader is automatically added.@baotrung-pham-20230331 commented on GitHub (Jan 2, 2024):
dang...you are right.
I'll close this issue then. Thank you