WordPress\AiClient\Providers\Http\DTO

RequestOptions::setMaxRedirectspublicWP 0.2.0

Sets the maximum number of redirects to follow.

Set to 0 to disable redirects, null for unspecified, or a positive integer to enable redirects with a maximum count.

Method of the class: RequestOptions{}

No Hooks.

Returns

null. Nothing (null).

Usage

$RequestOptions = new RequestOptions();
$RequestOptions->setMaxRedirects( ?int $maxRedirects ): void;
?int $maxRedirects(required)
.

Changelog

Since 0.2.0 Introduced.

RequestOptions::setMaxRedirects() code WP 7.0

public function setMaxRedirects(?int $maxRedirects): void
{
    if ($maxRedirects !== null && $maxRedirects < 0) {
        throw new InvalidArgumentException('Request option "maxRedirects" must be greater than or equal to 0.');
    }
    $this->maxRedirects = $maxRedirects;
}