Edit

Share via


UrlString class

Url object class which can perform various transformations on url strings.

Constructors

UrlString(string)

Properties

urlString

Methods

appendQueryString(string, string)

Given a url and a query string return the url with provided query string appended

canonicalizeUri(string)

Ensure urls are lower case and end with a / character.

constructAuthorityUriFromObject(IUri)
getAbsoluteUrl(string, string)
getDomainFromUrl(string)
getUrlComponents()

Parses out the components from a url string.

hashContainsKnownProperties(string)

Check if the hash of the URL string contains known properties

removeHashFromUrl(string)

Returns a url with the hash removed

replaceTenantPath(string)

Given a url like https://a:b/common/d?e=f#g, and a tenantId, returns https://a:b/tenantId/d

validateAsUri()

Throws if urlString passed is not a valid authority URI string.

Constructor Details

UrlString(string)

new UrlString(url: string)

Parameters

url

string

Property Details

urlString

string urlString

Property Value

string

Method Details

appendQueryString(string, string)

Given a url and a query string return the url with provided query string appended

static function appendQueryString(url: string, queryString: string): string

Parameters

url

string

queryString

string

Returns

string

canonicalizeUri(string)

Ensure urls are lower case and end with a / character.

static function canonicalizeUri(url: string): string

Parameters

url

string

Returns

string

constructAuthorityUriFromObject(IUri)

static function constructAuthorityUriFromObject(urlObject: IUri): UrlString

Parameters

urlObject
@azure/msal-common.IUri

Returns

getAbsoluteUrl(string, string)

static function getAbsoluteUrl(relativeUrl: string, baseUrl: string): string

Parameters

relativeUrl

string

baseUrl

string

Returns

string

getDomainFromUrl(string)

static function getDomainFromUrl(url: string): string

Parameters

url

string

Returns

string

getUrlComponents()

Parses out the components from a url string.

function getUrlComponents(): IUri

Returns

@azure/msal-common.IUri

An object with the various components. Please cache this value insted of calling this multiple times on the same url.

hashContainsKnownProperties(string)

Warning

This API is now deprecated.

This API will be removed in a future version

Check if the hash of the URL string contains known properties

static function hashContainsKnownProperties(response: string): boolean

Parameters

response

string

Returns

boolean

removeHashFromUrl(string)

Returns a url with the hash removed

static function removeHashFromUrl(url: string): string

Parameters

url

string

Returns

string

replaceTenantPath(string)

Given a url like https://a:b/common/d?e=f#g, and a tenantId, returns https://a:b/tenantId/d

function replaceTenantPath(tenantId: string): UrlString

Parameters

tenantId

string

The tenant id to replace

Returns

validateAsUri()

Throws if urlString passed is not a valid authority URI string.

function validateAsUri()