Skip to content

[Scripting] Possible to parse a URL? #885

@jsorge

Description

@jsorge

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 url module (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:

var URL = require('url').URL;
var myURL = new URL('http://www.example.com/foo?bar=1#main');
console.log(myURL.host); // prints 'www.example.com'

However when I try to do this in the Scripting window I get this error:

❌Error: Could not import 3rd scripts at url. Only support @users, @addons and @libs
❌Error: TypeError: undefined is not an object (evaluating 'require('url').URL') 

I'm hoping there's a way to do what I'm after. Thanks for a great app; Proxyman is fantastic!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions