mirror of
https://github.com/ProxymanApp/Proxyman.git
synced 2026-04-27 17:15:49 +03:00
[GH-ISSUE #894] Scripting error when application uses wrong content-type #889
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#889
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 @TemporalAgent7 on GitHub (May 21, 2021).
Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/894
Originally assigned to: @NghiaTranUIT on GitHub.
Proxyman version? (Ex. Proxyman 1.4.3)
2.25.0 (22500)
macOS Version? (Ex. mac 10.14)
mac 11.3.1
Steps to reproduce
The application sends an invalid JSON object with Content-Type=application/json. I want to log this value.
I'm getting this error:
Error: Invalid JSON Object from given body. (Content-Type=application/json)Expected behavior
Add a way to pass invalid body data with application/json content-type (maybe a flag
ignoreContentTypeor something of that nature).Workarounds are also welcome (I can't fix the body, the app's server expects the invalid values).
@NghiaTranUIT commented on GitHub (May 21, 2021):
Hey @TemporalAgent7, since the Content-Type is invalid, so Proxyman could not know what type of the Request.Body to parse. Therefore, you get the error log.
To workaround, please look at the Request object at https://docs.proxyman.io/scripting/script#onrequest-object-format
You can access the rawBody and manually parse it to JSON object with JSON.parse()
For example:
@TemporalAgent7 commented on GitHub (May 21, 2021):
The remote server expects the data in invalid format, it will not process correctly if I send it JSON, it will also not process correctly if I send a different content-type.
It would be nice to have the option to be able to write to rawBody and configure Proxyman to ignore invalid content types.