Module basic module

Module url

url processing module

Object

URL

Create a UrlObject request object, see UrlObject

1
UrlObject url.URL;

Static function

format

Parameter construction of UrlObject object

1
static String url.format(Object args);

Call parameters:

  • args : Object, a dictionary object specifying construction parameters, supported fields are: protocol, slashes, username, password, hostname, port, pathname, query, hash

Return result:

  • String , returns the successfully constructed string

parse

Parse a url string

1 2 3
static UrlObject url.parse(String url, Boolean parseQueryString = false, Boolean slashesDenoteHost = false);

Call parameters:

  • url : String, specify the url string to be parsed
  • parseQueryString : Boolean, specify whether to parse the query
  • slashesDenoteHost : Boolean, default is false, if set to true, the string from after the string'//' to the next'/' will be parsed as host, for example,'//foo/bar', the result should be {host:'foo', pathname:'/bar'} instead of {pathname:'//foo/bar'}

Return result:

  • UrlObject , returns an object containing parsed data