mirror of
https://github.com/ProxymanApp/Proxyman.git
synced 2026-04-27 00:55:57 +03:00
[GH-ISSUE #1308] [Question] Map REST API when resource could be a path #1302
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#1302
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 @esdrasdl on GitHub (Jul 25, 2022).
Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1308
Originally assigned to: @NghiaTranUIT on GitHub.
Proxyman version?
3.7.0
macOS Version?
12.04
Expected behavior
I would like to do the following map using Map Local (Directory).
response: any json, could be a list of resources
response: any json
Even the mac doesn't allow a folder and file with the same name I tried to create a file as
item?param=1but it didn't work. How can I achieve this behavior?@NghiaTranUIT commented on GitHub (Jul 26, 2022):
Proxyman has supported the resource path without the extension. Ref: https://github.com/ProxymanApp/Proxyman/issues/842
Here is a sample config:
~/Desktop/local_folderMap Local Resolve path:
https://mydomain.com/path/to/resource/resources-> File:~/Desktop/local_folder/path/to/resource/resources=> The last
resourcepath is a File without extension.https://mydomain.com/path/to/resource/item-> File:~/Desktop/local_folder/path/to/resource/item=>
itemis a File without extension.If it doesn't work, it'd be great if you can share your map local configuration 👍
@esdrasdl commented on GitHub (Jul 26, 2022):
In your example, you setup two different paths, that works as expected
~/Desktop/local_folder/path/to/resource/resources
~/Desktop/local_folder/path/to/resource/item
But my case is a little bit different:
~/Desktop/local_folder/path/to/resource/resources
~/Desktop/local_folder/path/to/resource/resources/item
But I could solve it using a script:
Which leads me to another question
I would like to share this script with my coworkers. But to setup the file path I need to setup relative path beginning in my user folder (~/). So every time my coworkes would like to use the script, they need change the filePath. It could be solved using environment variable. What is the roadmap to add Environment Variable to proxyman?
With environment variable I can improve the script like that:
@NghiaTranUIT commented on GitHub (Jul 26, 2022):
Nice, it can be easily solved by using Scripting.
$USER_PATHis not supported yet. However,~is already working. It will expand on the different user names on runtime.So, the following code will work on your coworker too.
I'm not sure why your coworkers need to change the file path?
@esdrasdl commented on GitHub (Jul 26, 2022):
I want to put all my mocks in a Github project. Usually every developer creates your own folder to handle his projects.
Let's says that I have project called proxyman-mapper. Inside that project/folder I put the json on this path:
"proxyman-mapper/path/to/resource/resources.json". Everybody who wants to use must clone this repository. Someone could have ~/git/proxyman-mapper and the other one could use ~/git/projects/p-mapper. Everybody needs to change the path to your current location and be aware to not commit that change if he wants to commit anything.
With environment variable I can export the script together with this project and my coworkers only need to create a variable that fits their path.
@NghiaTranUIT commented on GitHub (Jul 27, 2022):
Thanks. I understand your problem @esdrasdl 👍
I will add logic to get the
$USER_PATHfrom env on runtime, and send you a Beta build soon 👍@NghiaTranUIT commented on GitHub (Jul 28, 2022):
Hey @esdrasdl let's try this beta build: https://proxyman.s3.us-east-2.amazonaws.com/beta/Proxyman_3.7.0_Support_Scripting_with_ENV.dmg
Changelog
~/.zshrc: , likeexport USER_PATH=MyPath/proxyman/file-mapperScreenshot
@NghiaTranUIT commented on GitHub (Jul 31, 2022):
Here is a v2 for this feature: https://proxyman.s3.us-east-2.amazonaws.com/beta/Proxyman_3.7.0_Support_ENV_for_scripting_v2.dmg