WP_Http::browser_redirect_compatibility( string $location, array $headers, string|array $data, array $options, WpOrgRequestsResponse $original )

In this article

Match redirect behavior to browser handling.

Description

Changes 302 redirects from POST to GET to match browser handling. Per RFC 7231, user agents can deviate from the strict reading of the specification for compatibility purposes.

Parameters

$locationstringrequired
URL to redirect to.
$headersarrayrequired
Headers for the redirect.
$datastring|arrayrequired
Body to send with the request.
$optionsarrayrequired
Redirect request options.
$originalWpOrgRequestsResponserequired
Response object.

Source

public static function browser_redirect_compatibility( $location, $headers, $data, &$options, $original ) {
	// Browser compatibility.
	if ( 302 === $original->status_code ) {
		$options['type'] = WpOrg\Requests\Requests::GET;
	}
}

Changelog

VersionDescription
4.6.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.