[GH-ISSUE #1801] [Scripting] Support native URL and URLSearchParams #1793

Open
opened 2026-03-03 19:54:27 +03:00 by kerem · 1 comment
Owner

Originally created by @NghiaTranUIT on GitHub (Oct 9, 2023).
Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1801

Originally assigned to: @NghiaTranUIT on GitHub.

Description

Some users complain that this script can't work:

async function onRequest(context, url, request) {
  console.log(url);

  const urlItem = new URL("https://example.com?foo=1&bar=2");
  const params1 = new URLSearchParams(urlItem.search);

  // Done
  return request;
}

and get the following error:

Error: ReferenceError: Can't find variable: URL
Error: ReferenceError: Can't find variable: URLSearchParams

The problem is:

  • URL and URLSearchParams are not natively supported by JavascriptCore framework.

Why this feature/change is important?

  • Can use URL and URLSearchParams
  • Easier to deconstruct the URL and handle the Search Param.
Originally created by @NghiaTranUIT on GitHub (Oct 9, 2023). Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1801 Originally assigned to: @NghiaTranUIT on GitHub. ## Description Some users complain that this script can't work: ```js async function onRequest(context, url, request) { console.log(url); const urlItem = new URL("https://example.com?foo=1&bar=2"); const params1 = new URLSearchParams(urlItem.search); // Done return request; } ``` and get the following error: ``` Error: ReferenceError: Can't find variable: URL Error: ReferenceError: Can't find variable: URLSearchParams ``` The problem is: - `URL` and `URLSearchParams` are not natively supported by JavascriptCore framework. ## Why this feature/change is important? - Can use [URL](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) and [URLSearchParams](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams) - Easier to deconstruct the URL and handle the Search Param.
Author
Owner
<!-- gh-comment-id:1753006267 --> @NghiaTranUIT commented on GitHub (Oct 9, 2023): Beta: https://download.proxyman.io/beta/Proxyman_4.12.0_Support_URL_and_URLSearchParams_for_Scripting_Tool.dmg ![CleanShot 2023-10-09 at 20 21 37@2x](https://github.com/ProxymanApp/Proxyman/assets/5878421/d41af747-41a1-4ef5-a8fa-6ab421d71099)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Proxyman#1793
No description provided.