url.format(urlObj)
Take a parsed URL object, and return a formatted URL string.
Here's how the formatting process works:
-
href
will be ignored. -
path
will be ignored. -
protocol
is treated the same with or without the trailing:
(colon).- The protocols
http
,https
,ftp
,gopher
,file
will be postfixed with://
(colon-slash-slash) as long ashost
/hostname
are present. - All other protocols
mailto
,xmpp
,aim
,sftp
,foo
, etc will be postfixed with:
(colon).
- The protocols
-
slashes
set totrue
if the protocol requires://
(colon-slash-slash)- Only needs to be set for protocols not previously listed as requiring slashes, such as
mongodb://localhost:8000/
, or ifhost
/hostname
are absent.
- Only needs to be set for protocols not previously listed as requiring slashes, such as
-
auth
will be used if present. -
hostname
will only be used ifhost
is absent. -
port
will only be used ifhost
is absent. -
host
will be used in place ofhostname
andport
. -
pathname
is treated the same with or without the leading/
(slash). -
query
(object; seequerystring
) will only be used ifsearch
is absent. -
search
will be used in place ofquery
.- It is treated the same with or without the leading
?
(question mark).
- It is treated the same with or without the leading
-
hash
is treated the same with or without the leading#
(pound sign, anchor).
Please login to continue.