Skip to content
Get Free Trial

HTTP Response Functions

These functions help manipulate HTTP response of browsers or devices.

Since
Sahi Pro 8.0.0

Modes Browser

_addResponseSubstitutionRule($name, $urlPattern, $isRegExp, $find, $replace)

Arguments

NameTypeDescription
$namestringResponse substitution rule name
$urlPatternstringSubstitution url pattern
$isRegExpbooleanBoolean parameter to find the string as regular expressions if true.
$findstringFind the value to replace.
$replacestringReplacing 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");
Since
Sahi Pro 8.0.0

Modes Browser

_removeResponseSubstitutionRule($name)

Arguments

NameTypeDescription
$namestringResponse 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");