Function: urlBuilder()
Call Signature
Section titled “Call Signature”urlBuilder():
UrlBuilderImpl
With no argument, resolves to the base origin (never null).
Returns
Section titled “Returns”UrlBuilderImpl
Call Signature
Section titled “Call Signature”urlBuilder(
input?):UrlBuilderImpl|undefined
Coerce a UrlLike into a chainable UrlBuilder, or null
when the input cannot be parsed into a URL. Never throws.
- A
URLinstance or{ url }wrapper is adopted as-is. - A bare hostname (
"example.com") is upgraded tohttps://; an explicit scheme is preserved. - A path / query / hash fragment (
"/api","?q=1","#x") is resolved against defaultUrl (the browser origin, elsehttp://localhost). - An empty / blank string or omitted input resolves to the base origin.
Parameters
Section titled “Parameters”input?
Section titled “input?”Returns
Section titled “Returns”UrlBuilderImpl | undefined
Example
Section titled “Example”urlBuilder("example.com"); // https://example.com/urlBuilder("http://x/path"); // http://x/pathurlBuilder("/api/v2"); // http://localhost/api/v2urlBuilder({ url: "http://y" }); // http://y/urlBuilder(); // http://localhost/