mirror of
https://github.com/ProxymanApp/Proxyman.git
synced 2026-04-25 16:15:55 +03:00
[GH-ISSUE #998] [Bug] Scripting - if a script has Use as Mock API enabled do not pass through response if script is in Editing Mode #992
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#992
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 @crankygeek on GitHub (Sep 17, 2021).
Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/998
Originally assigned to: @NghiaTranUIT on GitHub.
I have been using the "Use as Mock API" function with my scripts to run tests that would normally be destructive, allowing me to perform multiple tests without having to setup data on the server for each pass.
Today, I accidentally left a script in Editing Mode and when I made the call to the specified endpoint, the script was bypassed which sent the request onto the server which deleted the data that I needed to complete additional tests. I had to stop my testing to setup the data again before I could continue.
I think if Use as Mock API is enabled, no requests should pass through to the server, regardless of Script Editing state. I would argue that this should happen any time the script is Editing Mode since it's easy to leave it in this state accidentally. But modifying the Mock API setting behavior would take care of my use case.
Proxyman version? (Ex. Proxyman 1.4.3)
Version 2.32.1 (23210)
macOS Version? (Ex. mac 10.14)
MacBook Pro (16-inch, 2019) macOS 11.6
Steps to reproduce
example.comfor any methodexample.comExpected behavior
I'm not sure what the Proxyman UI experience should be here, but my expectations when the Mock API setting is enabled is that the request will never been passed through to the server.
Perhaps a different console warning could be displayed explaining that the script was not executed, but the request was also blocked due to Mock API being enabled?
@NghiaTranUIT commented on GitHub (Sep 17, 2021):
It's a reasonable point 👍
I fixed it. If you don't mind, please try this beta build: https://proxyman.s3.us-east-2.amazonaws.com/beta/Proxyman_2.32.1_Improve_Mock_API_Scripting.dmg
Thanks again for opening a detailed ticket. I love it 😄
@crankygeek commented on GitHub (Sep 17, 2021):
I'm seeing a slight difference in the response bodies when the script run vs when it's in editing mode. Maybe this is expected?
Also the raw output displayed in the browser is different (no newlines/pretty layout when script is active, array order is different).
Besides that, it looks like the requests are not passing through when Mock API is enabled. 🏆
Thanks!
@NghiaTranUIT commented on GitHub (Sep 18, 2021):
When it's in the editing mode, it will return the template mocking response, which is:
Can you share with me the screenshot of "(no newlines/pretty layout when script is active" because I haven't changed this behavior.
If you mean that the Key order of a Dictionary, It's a limitation when casting Object from JavascriptCore to Swift. In swift, Dictionary doesn't have order, so the order might be changed