WP_Http::browser_redirect_compatibility()public staticWP 4.6.0

Match redirect behaviour to browser handling.

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.

{} It's a method of the class: WP_Http{}

No Hooks.

Return

null. Nothing.

Usage

$result = WP_Http::browser_redirect_compatibility( $location, $headers, $data, $options, $original );
$location(string) (required)
URL to redirect to.
$headers(array) (required)
Headers for the redirect.
$data(string|array) (required)
Body to send with the request.
$options(array) (required) (passed by reference — &)
Redirect request options.
$original(Requests_Response) (required)
Response object.

Changelog

Since 4.6.0 Introduced.

Code of WP_Http::browser_redirect_compatibility() WP 6.0

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