mirror of
https://github.com/ProxymanApp/Proxyman.git
synced 2026-04-27 17:15:49 +03:00
[GH-ISSUE #938] Map remote: Can't map two URLs with partial path matching #934
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#934
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 @cameroncooke on GitHub (Jul 15, 2021).
Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/938
Originally assigned to: @NghiaTranUIT on GitHub.
I want to map the following URL to the target URL while preserving some of the path:
I want to use the path from the
*onwards as the entire path to be used as the input on the target path.Example matches would be:
I can't see a way to do this currently because the Map Remote tool allows you to replace the entire path but not match part of the path.
I thought about using the RegEx feature and using capture groups but I don't think you can use the replacements patterns in the "Map To -> Path" field.
Proxyman version? (Ex. Proxyman 1.4.3)
2.29.0 (22900)
macOS Version? (Ex. mac 10.14)
12.0 Beta (21A5284e)
Steps to reproduce
Expected behavior
To be able to use the wildcard part of the source path as the target path or support regex capture groups from the source URL in the target path field.
Screenshots (optional)
@chaoyangnz commented on GitHub (Nov 4, 2021):
yep, it is useless when we cannot capture the group and do replacement
@NghiaTranUIT commented on GitHub (Nov 5, 2021):
It's straightforward to achieve it if you're using the Scripting tool @chaoyangnz
Please check out this snippet code: https://docs.proxyman.io/scripting/snippet-code#change-request-destination-scheme-host-port-path
Just use some if statement and write your own logic with simple Javascript code 👍
If you'd like using Regex, it's possible too: https://docs.proxyman.io/scripting/snippet-code#regex
I'm reluctant to implement this feature because it might introduce many edge cases that I could not cover yet.
@cameroncooke commented on GitHub (Nov 5, 2021):
To be fair, it’s not that simple. Requires learning JavaScript and
understanding the API.
Being able to just pattern match is far easier. I’m not a fan of in-app
scripting environments. Seems like a way to say to your end-users who need
a feature “write your own”. The thing is we pay for this product already.
If I need to mock APIs I’ll use Postman or any other dedicated tool.
If adding this as a new feature could introduce edge cases god knows what
scripting this could do?
How comes Charles has no problem doing this?
If this app has a robust test suite as I would expect then adding this
feature should be fairly easy to validate.
On Fri, 5 Nov 2021 at 07:30, Nghia Tran @.***> wrote:
@NghiaTranUIT commented on GitHub (Nov 5, 2021):
it makes sense that Proxyman should implement this feature, which is supported by Charles Proxy. I will put it in our road map 👍
@cameroncooke commented on GitHub (Nov 5, 2021):
Thank you for being open to being challenged, it's quite refreshing. Keep up the good work!
@chaoyangnz commented on GitHub (Nov 5, 2021):
Definitely I know scripting can achieve.
It’s nice to enhance scripting tool, I am not sure which JS engine is used, I cannot use lots of JS objects which is normally in browser and nodejs. When I need to implement a relatively real-life script, some libs are missing and even it provides the capability of adding libs or add-ons. It is actually not easy.
a simple requirement I’d like to forward a request to a server, I cannot modify request url directly, I have to parse URL into parts and assign to request host/port/path/queries, and URL parsing this basic function is not pre-defined.
Please consider this feature.
@chaoyangnz commented on GitHub (Nov 5, 2021):
I agree with you. Most of the time, we just need to map a url so as to point to another.
Scripting is flexible, but at the end of the day, it will end up with the script management: debugging, version control, sharing with peers etc.
@NghiaTranUIT commented on GitHub (Nov 16, 2021):
Hey @cameroncooke and @chaoyangnz, I've fixed this problem on this beta build: https://proxyman.s3.us-east-2.amazonaws.com/beta/Proxyman_2.35.0_Partial_group_matching_map_remote.dmg
From now, Map Remote can perform "Partial Matching". For instance,
At the moment, partial matching (
*) is only applied for the Path and it requires two*.@cameroncooke commented on GitHub (Nov 30, 2021):
Hi,
Thanks for this, looks great, I've not had time to test it yet but it looks
exactly what we needed so thank you so much!
Cameron.
On Tue, 16 Nov 2021 at 12:54, Nghia Tran @.***> wrote: