HTTP Response Functions
These functions help manipulate HTTP response of browsers or devices.
_addResponseSubstitutionRule
Section titled “_addResponseSubstitutionRule”- Since
- Sahi Pro 8.0.0
Modes Browser
_addResponseSubstitutionRule($name, $urlPattern, $isRegExp, $find, $replace)Arguments
| Name | Type | Description |
|---|---|---|
$name | string | Response substitution rule name |
$urlPattern | string | Substitution url pattern |
$isRegExp | boolean | Boolean parameter to find the string as regular expressions if true. |
$find | string | Find the value to replace. |
$replace | string | Replacing all occurrences of old value in this string. |
Returns
null |
Substitutes the HTTP response for all further responces coming in this browser session. If a HTTP Response Substitution Rule of given name already exists, it will be replaced.
//Add the response substitution rule._addResponseSubstitutionRule("test", "https://sahitest.com/demo/", false, "Link Test", "Link Test1");_removeResponseSubstitutionRule
Section titled “_removeResponseSubstitutionRule”- Since
- Sahi Pro 8.0.0
Modes Browser
_removeResponseSubstitutionRule($name)Arguments
| Name | Type | Description |
|---|---|---|
$name | string | Response substitution rule name |
Returns
null |
Removes the response substitution rule for all further responces coming in this browser session.
//Remove the response substitution rule._removeResponseSubstitutionRule("test");
