Class: UrlTransformer
Defined in: packages/core/src/http/UrlTransformer.ts:6
Utility for transforming URLs according to the configured replacement rules.
Constructors
new UrlTransformer()
new UrlTransformer():
UrlTransformer
Defined in: packages/core/src/http/UrlTransformer.ts:16
Initializes the URL transformer.
Returns
Properties
_rules
protected
_rules:StringParameters
Defined in: packages/core/src/http/UrlTransformer.ts:7
Accessors
$dependencies
Get Signature
get
static
$dependencies():never
[]
Defined in: packages/core/src/http/UrlTransformer.ts:9
Returns
never
[]
Methods
addRule()
addRule(
pattern
,replacement
):UrlTransformer
Defined in: packages/core/src/http/UrlTransformer.ts:30
Adds the provided replacement rule to the rules used by this URL transformer.
Parameters
pattern
string
Regexp patter to look for (must be escaped as if for use in the Regexp constructor).
replacement
string
The replacement of the matched patter in any matched URL.
Returns
This transformer.
clear()
clear():
UrlTransformer
Defined in: packages/core/src/http/UrlTransformer.ts:39
Clears all rules.
Returns
transform()
transform(
url
):string
Defined in: packages/core/src/http/UrlTransformer.ts:53
Applies all rules registered with this URL transformer to the provided URL and returns the result. The rules will be applied in the order they were registered.
Parameters
url
string
The URL for transformation.
Returns
string
Transformed URL.