mirror of
https://github.com/ProxymanApp/Proxyman.git
synced 2026-04-26 16:45:57 +03:00
[GH-ISSUE #885] [Scripting] Possible to parse a URL? #880
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#880
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 @jsorge on GitHub (May 11, 2021).
Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/885
Originally assigned to: @NghiaTranUIT on GitHub.
Proxyman version? (Ex. Proxyman 1.4.3)
2.25.0
macOS Version? (Ex. mac 10.14)
11.3.1
In Scripting, is it possible to use the
urlmodule (I'm not sure what it's called in JS) to parse a URL? I've got this code in a CodeRunner window using Node and it works:However when I try to do this in the Scripting window I get this error:
I'm hoping there's a way to do what I'm after. Thanks for a great app; Proxyman is fantastic!
@NghiaTranUIT commented on GitHub (May 12, 2021):
Hi @jsorge Unfortunately, the scripting could not use NodeJS modules because the scripting is built on top of JavascriptCore, which is a pure JS framework.
JavascriptCore doesn't support this URL too
Just wondering: How often do you use URL for the scripting? If it's an important class, I might find a solution to support it 👍
@jsorge commented on GitHub (May 12, 2021):
Ah yeah that makes sense @NghiaTranUIT, thanks for the explanation!
It's not something I'm doing a bunch (today was the first time) but I do have to find an alternate solution. I really only need the value of a path parameter so maybe it's time to turn to a regex.
@NghiaTranUIT commented on GitHub (May 12, 2021):
You can easily get a path of the URL by using
Ref: https://docs.proxyman.io/scripting/script#onrequest-object-format
@jsorge commented on GitHub (May 12, 2021):
Ah yeah this is a bit different. We route to new places in our app through protocol URIs that come in the payload as strings. I need to parse one of those 😊
@NghiaTranUIT commented on GitHub (May 12, 2021):
Thanks. I will find a way to support native URL if it's possible 👍
@Zirro commented on GitHub (Dec 1, 2021):
https://github.com/zloirock/core-js has well-designed implementations of
URLandURLSearchParams(among many others) which are designed to work in buggy or unusual environments that don't support them natively. You could probably inject them as globals into JavaScriptCore and have them work as if they were a native implementation.@NghiaTranUIT commented on GitHub (Dec 2, 2021):
Thanks for your suggestion @Zirro Let me play around and try to integrate it 👍