Interface: URLAttributes
The attributes of a URL, given to the URLBuilder constructor to build one; all are optional.
Properties
auth?
optionalauth?:string
The credentials, username:password or username: they set username and password.
hash?
optionalhash?:string
The fragment, # added when missing.
host?
optionalhost?:string
The host name with its port ('example.com:8080'): it sets hostname and port, which win over it when given too.
hostname?
optionalhostname?:string
The host name, without port.
href?
optionalhref?:string
Kept as given, not used to build: the URL is made of the other attributes.
origin?
optionalorigin?:string
Kept as given, not used to build: it is the protocol and the host.
password?
optionalpassword?:string
The password of the credentials, percent-encoded when built.
pathname?
optionalpathname?:string
The path, / added when missing.
port?
optionalport?:string
The port; not written when it is the scheme's default (443 for https, 80 for http).
protocol?
optionalprotocol?:string
The scheme, with or without its colon ('https', 'redis:'). Any scheme is accepted.
query?
optionalquery?:Record<string,string>
The query parameters by name, percent-encoded when built ({q: 'a b'} gives ?q=a%20b); an empty object gives no query.
slashes?
optionalslashes?:boolean
Whether the protocol is followed by // (always for http, https, ws, wss, ftp, file and gopher).
Default
true with a protocolusername?
optionalusername?:string
The user name of the credentials, percent-encoded when built.