UrlBuilder
Constructors
constructor
- new
Url Builder(url: string, hasQuery?: boolean): UrlBuilder
-
Default constructor.
Parameters-
url: string
The base URL.
-
hasQuery: boolean = false
Whether the base URL already contains query parameters.
Returns UrlBuilder -
Methods
append Query
- append
Query(key: string, value?: string | number | boolean | string[] | number[], operator?: string): void
-
Appends a query parameter to the URL, either using '&key=value' or '?key=value' depending on the hasQuery parameter.
Escapes all strings using
encodeURIComponent.String arrays are concatenated using commas.
Parameters-
key: string
The key of the query parameter.
-
Optional value: string | number | boolean | string[] | number[]
The value of the query parameter.
-
operator: string = "="
Returns void -
Helper class that builds URLs from a baseUrl and given query parameters