Controller
getRedirect()
Signature
Section titled “Signature”getRedirect() — returns struct
Available in: controller
Category: Miscellaneous Functions
Description
Section titled “Description”Primarily used in testing scenarios to determine whether the current request has performed a redirect. It returns a structure containing information about the redirect, such as the target URL and the HTTP status code. This allows you to verify redirect behavior in automated tests without actually sending the user to another page.
Examples
Section titled “Examples”1. Get redirect information for the current request
redirectInfo = getRedirect();
// Check if a redirect occurred
if (structKeyExists(redirectInfo, "url")) {
writeOutput("Redirected to: " & redirectInfo.url);
writeOutput("HTTP status: " & redirectInfo.status);
} else {
writeOutput("No redirect occurred.");
}