ProxymanApp / ProxymanApp/Proxyman

[Bug] Scripting - if a script has Use as Mock API enabled do not pass through response if script is in Editing Mode

Open
#998 3 comments 0 reactions 1 assignee View on GitHub

@NghiaTranUIT is already working on this.

Since Sep 17, 2021.

✅ Done Feature request
Dominant language
No language data
Stars
7k
Forks
237
PR merge metrics
No merged PRs in 30d

Description

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
  1. Add a new scripting rule that matches example.com for any method
  2. Enable Use as Mock API for the script (Click More > Use onResponse() as Mock API)
  3. Make a change to the script to put it into Editing Mode
  4. On device that is configured to proxy through Proxyman, open example.com
  5. Observe the Scripting console reports "Skip executing the script because it is on Editing Mode." and that the request is sent to the server and the page loads normally in the browser
Expected 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?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.